added SchedulePlaylistWindow and SchedulerWindow
and lots of other changes
This commit is contained in:
parent
55f9031672
commit
f99bc8bc40
|
@ -21,7 +21,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Author : $Author: maroy $
|
# Author : $Author: maroy $
|
||||||
# Version : $Revision: 1.19 $
|
# Version : $Revision: 1.20 $
|
||||||
# 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@
|
||||||
|
@ -70,7 +70,13 @@ GENRBOPTS = --destdir ${TMP_DIR} \
|
||||||
|
|
||||||
VPATH = ${SRC_DIR}
|
VPATH = ${SRC_DIR}
|
||||||
|
|
||||||
MODULES_DIR = ${BASE_DIR}/../../modules
|
MODULES_DIR = ${BASE_DIR}/../../modules
|
||||||
|
PRODUCTS_DIR = ${BASE_DIR}/../../products
|
||||||
|
|
||||||
|
STORAGE_SERVER_DIR = ${MODULES_DIR}/storageServer
|
||||||
|
|
||||||
|
SCHEDULER_DIR = ${PRODUCTS_DIR}/scheduler
|
||||||
|
SCHEDULER_EXE = ${SCHEDULER_DIR}/tmp/scheduler
|
||||||
|
|
||||||
CORE_DIR = ${MODULES_DIR}/core
|
CORE_DIR = ${MODULES_DIR}/core
|
||||||
CORE_INCLUDE_DIR = ${CORE_DIR}/include
|
CORE_INCLUDE_DIR = ${CORE_DIR}/include
|
||||||
|
@ -101,6 +107,7 @@ PLAYLIST_EXECUTOR_INCLUDE_DIR = ${PLAYLIST_EXECUTOR_DIR}/include
|
||||||
PLAYLIST_EXECUTOR_LIB_DIR = ${PLAYLIST_EXECUTOR_DIR}/lib
|
PLAYLIST_EXECUTOR_LIB_DIR = ${PLAYLIST_EXECUTOR_DIR}/lib
|
||||||
PLAYLIST_EXECUTOR_LIB = livesupport_playlist_executor
|
PLAYLIST_EXECUTOR_LIB = livesupport_playlist_executor
|
||||||
PLAYLIST_EXECUTOR_LIB_FILE = ${PLAYLIST_EXECUTOR_LIB_DIR}/lib${PLAYLIST_EXECUTOR_LIB}.a
|
PLAYLIST_EXECUTOR_LIB_FILE = ${PLAYLIST_EXECUTOR_LIB_DIR}/lib${PLAYLIST_EXECUTOR_LIB}.a
|
||||||
|
|
||||||
LIBXMLPP_CFLAGS=@LIBXMLPP_CFLAGS@
|
LIBXMLPP_CFLAGS=@LIBXMLPP_CFLAGS@
|
||||||
LIBXMLPP_LIBS=@LIBXMLPP_LIBS@
|
LIBXMLPP_LIBS=@LIBXMLPP_LIBS@
|
||||||
|
|
||||||
|
@ -169,7 +176,9 @@ G_LIVESUPPORT_OBJS = ${TMP_DIR}/GLiveSupport.o \
|
||||||
${TMP_DIR}/PlaylistListWindow.o \
|
${TMP_DIR}/PlaylistListWindow.o \
|
||||||
${TMP_DIR}/UploadFileWindow.o \
|
${TMP_DIR}/UploadFileWindow.o \
|
||||||
${TMP_DIR}/DjBagWindow.o \
|
${TMP_DIR}/DjBagWindow.o \
|
||||||
${TMP_DIR}/SimplePlaylistManagementWindow.o
|
${TMP_DIR}/SimplePlaylistManagementWindow.o \
|
||||||
|
${TMP_DIR}/SchedulerWindow.o \
|
||||||
|
${TMP_DIR}/SchedulePlaylistWindow.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 \
|
||||||
|
@ -234,6 +243,20 @@ run_tests: ${TEST_RUNNER}
|
||||||
run: all
|
run: all
|
||||||
${G_LIVESUPPORT_EXE} -c ${G_LIVESUPPORT_CFG}
|
${G_LIVESUPPORT_EXE} -c ${G_LIVESUPPORT_CFG}
|
||||||
|
|
||||||
|
install: ${SCHEDULER_EXE}
|
||||||
|
-${MAKE} -C ${STORAGE_SERVER_DIR} db_init
|
||||||
|
-${MAKE} -C ${SCHEDULER_DIR} install_web
|
||||||
|
|
||||||
|
start: ${SCHEDULER_EXE}
|
||||||
|
${MAKE} -C ${SCHEDULER_DIR} start_web
|
||||||
|
|
||||||
|
stop: ${SCHEDULER_EXE}
|
||||||
|
${MAKE} -C ${SCHEDULER_DIR} stop_web
|
||||||
|
|
||||||
|
uninstall: ${SCHEDULER_EXE}
|
||||||
|
-${MAKE} -C ${SCHEDULER_DIR} uninstall_web
|
||||||
|
-${MAKE} -C ${STORAGE_SERVER_DIR} db_clean
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Specific targets
|
# Specific targets
|
||||||
|
|
|
@ -23,6 +23,13 @@
|
||||||
|
|
||||||
<!ELEMENT testAuthentication (user) >
|
<!ELEMENT testAuthentication (user) >
|
||||||
|
|
||||||
|
<!ELEMENT webAuthentication (location) >
|
||||||
|
|
||||||
|
<!ELEMENT location EMPTY >
|
||||||
|
<!ATTLIST location server CDATA #REQUIRED >
|
||||||
|
<!ATTLIST location port NMTOKEN #REQUIRED >
|
||||||
|
<!ATTLIST location path CDATA #REQUIRED >
|
||||||
|
|
||||||
<!ELEMENT user EMPTY >
|
<!ELEMENT user EMPTY >
|
||||||
<!ATTLIST user login CDATA #REQUIRED >
|
<!ATTLIST user login CDATA #REQUIRED >
|
||||||
<!ATTLIST user password CDATA #REQUIRED >
|
<!ATTLIST user password CDATA #REQUIRED >
|
||||||
|
@ -54,11 +61,6 @@
|
||||||
<!ELEMENT webStorage (location) >
|
<!ELEMENT webStorage (location) >
|
||||||
<!ATTLIST webStorage tempFiles CDATA #REQUIRED >
|
<!ATTLIST webStorage tempFiles CDATA #REQUIRED >
|
||||||
|
|
||||||
<!ELEMENT location EMPTY >
|
|
||||||
<!ATTLIST location server CDATA #REQUIRED >
|
|
||||||
<!ATTLIST location port NMTOKEN #REQUIRED >
|
|
||||||
<!ATTLIST location path CDATA #REQUIRED >
|
|
||||||
|
|
||||||
<!ELEMENT schedulerClientFactory (schedulerDaemonXmlRpcClient) >
|
<!ELEMENT schedulerClientFactory (schedulerDaemonXmlRpcClient) >
|
||||||
|
|
||||||
<!ELEMENT schedulerDaemonXmlRpcClient EMPTY >
|
<!ELEMENT schedulerDaemonXmlRpcClient EMPTY >
|
||||||
|
@ -83,50 +85,17 @@
|
||||||
</supportedLanguages>
|
</supportedLanguages>
|
||||||
|
|
||||||
<authenticationClientFactory>
|
<authenticationClientFactory>
|
||||||
<testAuthentication>
|
<webAuthentication>
|
||||||
<user login="root" password="q" />
|
<location server="localhost" port="80"
|
||||||
</testAuthentication>
|
path="/livesupportStorageServer/xmlrpc/xrLocStor.php" />
|
||||||
|
</webAuthentication>
|
||||||
</authenticationClientFactory>
|
</authenticationClientFactory>
|
||||||
|
|
||||||
<storageClientFactory>
|
<storageClientFactory>
|
||||||
<testStorage tempFiles="file:///tmp/tempPlaylist">
|
<webStorage tempFiles="file:///tmp/webStorageClient" >
|
||||||
<playlist id="1" playlength="00:00:34.000" >
|
<location server="localhost" port="80"
|
||||||
<playlistElement id="101" relativeOffset="0" >
|
path="/livesupportStorageServer/xmlrpc/xrLocStor.php" />
|
||||||
<audioClip id="10001" playlength="00:00:11.000"
|
</webStorage>
|
||||||
title="one"
|
|
||||||
uri="file:var/test1.mp3" />
|
|
||||||
</playlistElement>
|
|
||||||
<playlistElement id="102" relativeOffset="00:00:11.000000" >
|
|
||||||
<audioClip id="10002" playlength="00:00:12.000000"
|
|
||||||
title="two"
|
|
||||||
uri="file:var/test2.mp3" />
|
|
||||||
<fadeInfo id="9901" fadeIn="00:00:02.000000"
|
|
||||||
fadeOut="00:00:01.500000" />
|
|
||||||
</playlistElement>
|
|
||||||
<playlistElement id="103" relativeOffset="00:00:23.000000" >
|
|
||||||
<playlist id="2" playlength="00:00:11.000000" >
|
|
||||||
<playlistElement id="111" relativeOffset="0" >
|
|
||||||
<audioClip id="10003" playlength="00:00:11.000"
|
|
||||||
title="three"
|
|
||||||
uri="file:var/test3.mp3" />
|
|
||||||
</playlistElement>
|
|
||||||
</playlist>
|
|
||||||
</playlistElement>
|
|
||||||
</playlist>
|
|
||||||
<playlist id="2" playlength="00:00:11.000000" >
|
|
||||||
<playlistElement id="111" relativeOffset="0" >
|
|
||||||
<audioClip id="10003" playlength="00:00:11.000"
|
|
||||||
title="three"
|
|
||||||
uri="file:var/test3.mp3" />
|
|
||||||
</playlistElement>
|
|
||||||
</playlist>
|
|
||||||
<audioClip id="10001" playlength="01:00:00.000"
|
|
||||||
title="one"
|
|
||||||
uri="file:var/test1.mp3" />
|
|
||||||
<audioClip id="10002" playlength="00:30:00.000"
|
|
||||||
title="two"
|
|
||||||
uri="file:var/test2.mp3" />
|
|
||||||
</testStorage>
|
|
||||||
</storageClientFactory>
|
</storageClientFactory>
|
||||||
|
|
||||||
<schedulerClientFactory>
|
<schedulerClientFactory>
|
||||||
|
|
|
@ -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/DjBagWindow.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/DjBagWindow.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -36,6 +36,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
|
#include "SchedulePlaylistWindow.h"
|
||||||
#include "DjBagWindow.h"
|
#include "DjBagWindow.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -119,19 +120,45 @@ DjBagWindow :: DjBagWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
&DjBagWindow::onEntryClicked));
|
&DjBagWindow::onEntryClicked));
|
||||||
|
|
||||||
|
|
||||||
// create the right-click entry context menu
|
// create the right-click entry context menu for audio clips
|
||||||
entryMenu.reset(new Gtk::Menu());
|
audioClipMenu.reset(new Gtk::Menu());
|
||||||
Gtk::Menu::MenuList& menuList = entryMenu->items();
|
Gtk::Menu::MenuList& audioClipMenuList = audioClipMenu->items();
|
||||||
// register the signal handlers for the popup menu
|
// register the signal handlers for the popup menu
|
||||||
menuList.push_back(Gtk::Menu_Helpers::MenuElem(
|
audioClipMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
|
||||||
*getResourceUstring("addToPlaylistMenuItem"),
|
*getResourceUstring("addToPlaylistMenuItem"),
|
||||||
sigc::mem_fun(*this,
|
sigc::mem_fun(*this,
|
||||||
&DjBagWindow::onAddToPlaylist)));
|
&DjBagWindow::onAddToPlaylist)));
|
||||||
menuList.push_back(Gtk::Menu_Helpers::MenuElem(
|
audioClipMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
|
||||||
*getResourceUstring("removeMenuItem"),
|
*getResourceUstring("removeMenuItem"),
|
||||||
sigc::mem_fun(*this,
|
sigc::mem_fun(*this,
|
||||||
&DjBagWindow::onRemoveItem)));
|
&DjBagWindow::onRemoveItem)));
|
||||||
entryMenu->accelerate(*this);
|
audioClipMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
|
||||||
|
*getResourceUstring("deleteMenuItem"),
|
||||||
|
sigc::mem_fun(*this,
|
||||||
|
&DjBagWindow::onDeleteItem)));
|
||||||
|
audioClipMenu->accelerate(*this);
|
||||||
|
|
||||||
|
// create the right-click entry context menu for playlists
|
||||||
|
playlistMenu.reset(new Gtk::Menu());
|
||||||
|
Gtk::Menu::MenuList& playlistMenuList = playlistMenu->items();
|
||||||
|
// register the signal handlers for the popup menu
|
||||||
|
playlistMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
|
||||||
|
*getResourceUstring("addToPlaylistMenuItem"),
|
||||||
|
sigc::mem_fun(*this,
|
||||||
|
&DjBagWindow::onAddToPlaylist)));
|
||||||
|
playlistMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
|
||||||
|
*getResourceUstring("schedulePlaylistMenuItem"),
|
||||||
|
sigc::mem_fun(*this,
|
||||||
|
&DjBagWindow::onSchedulePlaylist)));
|
||||||
|
playlistMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
|
||||||
|
*getResourceUstring("removeMenuItem"),
|
||||||
|
sigc::mem_fun(*this,
|
||||||
|
&DjBagWindow::onRemoveItem)));
|
||||||
|
playlistMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
|
||||||
|
*getResourceUstring("deleteMenuItem"),
|
||||||
|
sigc::mem_fun(*this,
|
||||||
|
&DjBagWindow::onDeleteItem)));
|
||||||
|
audioClipMenu->accelerate(*this);
|
||||||
|
|
||||||
// show
|
// show
|
||||||
showContents();
|
showContents();
|
||||||
|
@ -160,16 +187,18 @@ DjBagWindow :: showContents(void) throw ()
|
||||||
playable = *it;
|
playable = *it;
|
||||||
row = *(treeModel->append());
|
row = *(treeModel->append());
|
||||||
|
|
||||||
row[modelColumns.idColumn] = playable->getId();
|
row[modelColumns.playableColumn] = playable;
|
||||||
switch (playable->getType()) {
|
switch (playable->getType()) {
|
||||||
case Playable::AudioClipType:
|
case Playable::AudioClipType:
|
||||||
default:
|
|
||||||
row[modelColumns.typeColumn] = "audioclip";
|
row[modelColumns.typeColumn] = "audioclip";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Playable::PlaylistType:
|
case Playable::PlaylistType:
|
||||||
row[modelColumns.typeColumn] = "playlist";
|
row[modelColumns.typeColumn] = "playlist";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
row[modelColumns.titleColumn] = *playable->getTitle();
|
row[modelColumns.titleColumn] = *playable->getTitle();
|
||||||
|
|
||||||
|
@ -207,8 +236,23 @@ DjBagWindow :: onEntryClicked (GdkEventButton * event) throw ()
|
||||||
Glib::RefPtr<Gtk::TreeView::Selection> refSelection =
|
Glib::RefPtr<Gtk::TreeView::Selection> refSelection =
|
||||||
treeView.get_selection();
|
treeView.get_selection();
|
||||||
if (refSelection) {
|
if (refSelection) {
|
||||||
if (refSelection->get_selected()) {
|
Gtk::TreeModel::iterator iter = refSelection->get_selected();
|
||||||
entryMenu->popup(event->button, event->time);
|
if (iter) {
|
||||||
|
Ptr<Playable>::Ref playable =
|
||||||
|
(*iter)[modelColumns.playableColumn];
|
||||||
|
|
||||||
|
switch (playable->getType()) {
|
||||||
|
case Playable::AudioClipType:
|
||||||
|
audioClipMenu->popup(event->button, event->time);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Playable::PlaylistType:
|
||||||
|
playlistMenu->popup(event->button, event->time);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -227,9 +271,34 @@ DjBagWindow :: onRemoveItem(void) throw ()
|
||||||
if (refSelection) {
|
if (refSelection) {
|
||||||
Gtk::TreeModel::iterator iter = refSelection->get_selected();
|
Gtk::TreeModel::iterator iter = refSelection->get_selected();
|
||||||
if (iter) {
|
if (iter) {
|
||||||
Ptr<const UniqueId>::Ref id = (*iter)[modelColumns.idColumn];
|
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
||||||
|
|
||||||
removeItem(id);
|
removeItem(playable->getId());
|
||||||
|
showContents();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Event handler for the Delete menu item selected from the entry conext menu
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
DjBagWindow :: onDeleteItem(void) throw ()
|
||||||
|
{
|
||||||
|
Glib::RefPtr<Gtk::TreeView::Selection> refSelection =
|
||||||
|
treeView.get_selection();
|
||||||
|
|
||||||
|
if (refSelection) {
|
||||||
|
Gtk::TreeModel::iterator iter = refSelection->get_selected();
|
||||||
|
if (iter) {
|
||||||
|
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
||||||
|
|
||||||
|
try {
|
||||||
|
deleteItem(playable);
|
||||||
|
} catch (XmlRpcException &e) {
|
||||||
|
// TODO: signal error here
|
||||||
|
}
|
||||||
showContents();
|
showContents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -262,6 +331,18 @@ DjBagWindow :: removeItem(Ptr<const UniqueId>::Ref id) throw ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Delete an item from storage, and remove it from the dj bag
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
DjBagWindow :: deleteItem(Ptr<Playable>::Ref playable)
|
||||||
|
throw (XmlRpcException)
|
||||||
|
{
|
||||||
|
gLiveSupport->deletePlayable(playable);
|
||||||
|
removeItem(playable->getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Event handler for the Add To Playlist menu item selected from the
|
* Event handler for the Add To Playlist menu item selected from the
|
||||||
* entry conext menu
|
* entry conext menu
|
||||||
|
@ -275,9 +356,57 @@ DjBagWindow :: onAddToPlaylist(void) throw ()
|
||||||
if (refSelection) {
|
if (refSelection) {
|
||||||
Gtk::TreeModel::iterator iter = refSelection->get_selected();
|
Gtk::TreeModel::iterator iter = refSelection->get_selected();
|
||||||
if (iter) {
|
if (iter) {
|
||||||
Ptr<const UniqueId>::Ref id = (*iter)[modelColumns.idColumn];
|
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
||||||
|
|
||||||
gLiveSupport->addToPlaylist(id);
|
gLiveSupport->addToPlaylist(playable->getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Event handler for the Schedule Playlist menu item selected from the
|
||||||
|
* entry conext menu
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
DjBagWindow :: onSchedulePlaylist(void) throw ()
|
||||||
|
{
|
||||||
|
Glib::RefPtr<Gtk::TreeView::Selection> refSelection =
|
||||||
|
treeView.get_selection();
|
||||||
|
|
||||||
|
if (refSelection) {
|
||||||
|
Gtk::TreeModel::iterator iter = refSelection->get_selected();
|
||||||
|
if (iter) {
|
||||||
|
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
||||||
|
Ptr<UniqueId>::Ref uid = playable->getId();
|
||||||
|
|
||||||
|
Ptr<SessionId>::Ref sessionId =
|
||||||
|
gLiveSupport->getSessionId();
|
||||||
|
Ptr<StorageClientInterface>::Ref storage =
|
||||||
|
gLiveSupport->getStorage();
|
||||||
|
|
||||||
|
// append the appropriate playable object to the end of the playlist
|
||||||
|
if (!storage->existsPlaylist(sessionId, uid)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ptr<Playlist>::Ref playlist = storage->getPlaylist(sessionId, uid);
|
||||||
|
|
||||||
|
Ptr<ResourceBundle>::Ref bundle;
|
||||||
|
try {
|
||||||
|
bundle = gLiveSupport->getBundle("schedulePlaylistWindow");
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ptr<SchedulePlaylistWindow>::Ref scheduleWindow;
|
||||||
|
|
||||||
|
scheduleWindow.reset(new SchedulePlaylistWindow(gLiveSupport,
|
||||||
|
bundle,
|
||||||
|
playlist));
|
||||||
|
|
||||||
|
Gtk::Main::run(*scheduleWindow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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/DjBagWindow.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/DjBagWindow.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -68,7 +68,7 @@ using namespace LiveSupport::Core;
|
||||||
* playlists.
|
* playlists.
|
||||||
*
|
*
|
||||||
* @author $Author: maroy $
|
* @author $Author: maroy $
|
||||||
* @version $Revision: 1.2 $
|
* @version $Revision: 1.3 $
|
||||||
*/
|
*/
|
||||||
class DjBagWindow : public Gtk::Window, public LocalizedObject
|
class DjBagWindow : public Gtk::Window, public LocalizedObject
|
||||||
{
|
{
|
||||||
|
@ -80,15 +80,15 @@ class DjBagWindow : public Gtk::Window, public LocalizedObject
|
||||||
* Lists one clip per row.
|
* Lists one clip 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
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* The column for the id of the audio clip or playlist.
|
* The column for the playable object shown in the row.
|
||||||
*/
|
*/
|
||||||
Gtk::TreeModelColumn<Ptr<const UniqueId>::Ref> idColumn;
|
Gtk::TreeModelColumn<Ptr<Playable>::Ref> playableColumn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The column for the type of the entry in the list
|
* The column for the type of the entry in the list
|
||||||
|
@ -105,7 +105,7 @@ class DjBagWindow : public Gtk::Window, public LocalizedObject
|
||||||
*/
|
*/
|
||||||
ModelColumns(void) throw ()
|
ModelColumns(void) throw ()
|
||||||
{
|
{
|
||||||
add(idColumn);
|
add(playableColumn);
|
||||||
add(typeColumn);
|
add(typeColumn);
|
||||||
add(titleColumn);
|
add(titleColumn);
|
||||||
}
|
}
|
||||||
|
@ -153,10 +153,16 @@ class DjBagWindow : public Gtk::Window, public LocalizedObject
|
||||||
Ptr<Gtk::Button>::Ref closeButton;
|
Ptr<Gtk::Button>::Ref closeButton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The right-click context menu, that comes up when right-clicking
|
* The right-click context menu for audio clips,
|
||||||
* an entry in the entry list.
|
* that comes up when right-clicking an entry in the entry list.
|
||||||
*/
|
*/
|
||||||
Ptr<Gtk::Menu>::Ref entryMenu;
|
Ptr<Gtk::Menu>::Ref audioClipMenu;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The right-click context menu for playlists,
|
||||||
|
* that comes up when right-clicking an entry in the entry list.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Menu>::Ref playlistMenu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signal handler for the close button clicked.
|
* Signal handler for the close button clicked.
|
||||||
|
@ -179,6 +185,13 @@ class DjBagWindow : public Gtk::Window, public LocalizedObject
|
||||||
virtual void
|
virtual void
|
||||||
onRemoveItem(void) throw ();
|
onRemoveItem(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal handler for the "delete" menu item selected from
|
||||||
|
* the entry context menu.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
onDeleteItem(void) throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signal handler for the "add to playlist" menu item selected from
|
* Signal handler for the "add to playlist" menu item selected from
|
||||||
* the entry context menu.
|
* the entry context menu.
|
||||||
|
@ -186,6 +199,22 @@ class DjBagWindow : public Gtk::Window, public LocalizedObject
|
||||||
virtual void
|
virtual void
|
||||||
onAddToPlaylist(void) throw ();
|
onAddToPlaylist(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal handler for the "schedule playlist" menu item selected
|
||||||
|
* from the entry context menu.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
onSchedulePlaylist(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete an item from the storage and remove it from the dj bag.
|
||||||
|
*
|
||||||
|
* @param playable the Playable object to delete and remove.
|
||||||
|
* @exception XmlRpcException on XML-RPC errors.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
deleteItem(Ptr<Playable>::Ref playable) throw (XmlRpcException);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.11 $
|
Version : $Revision: 1.12 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -46,6 +46,8 @@
|
||||||
#include "GLiveSupport.h"
|
#include "GLiveSupport.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace boost;
|
||||||
|
|
||||||
using namespace LiveSupport::Core;
|
using namespace LiveSupport::Core;
|
||||||
using namespace LiveSupport::Authentication;
|
using namespace LiveSupport::Authentication;
|
||||||
using namespace LiveSupport::Storage;
|
using namespace LiveSupport::Storage;
|
||||||
|
@ -296,7 +298,7 @@ Ptr<AudioClip>::Ref
|
||||||
LiveSupport :: GLiveSupport ::
|
LiveSupport :: GLiveSupport ::
|
||||||
GLiveSupport :: uploadFile(Ptr<const Glib::ustring>::Ref title,
|
GLiveSupport :: uploadFile(Ptr<const Glib::ustring>::Ref title,
|
||||||
Ptr<const std::string>::Ref fileName)
|
Ptr<const std::string>::Ref fileName)
|
||||||
throw (StorageException)
|
throw (XmlRpcException)
|
||||||
{
|
{
|
||||||
// create a URI from the file name
|
// create a URI from the file name
|
||||||
Ptr<std::string>::Ref uri(new std::string("file://"));
|
Ptr<std::string>::Ref uri(new std::string("file://"));
|
||||||
|
@ -309,7 +311,7 @@ GLiveSupport :: uploadFile(Ptr<const Glib::ustring>::Ref title,
|
||||||
playlength = audioPlayer->getPlaylength();
|
playlength = audioPlayer->getPlaylength();
|
||||||
audioPlayer->close();
|
audioPlayer->close();
|
||||||
} catch (std::invalid_argument &e) {
|
} catch (std::invalid_argument &e) {
|
||||||
throw StorageException(e.what());
|
throw XmlRpcException(e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
// create and upload an AudioClip object
|
// create and upload an AudioClip object
|
||||||
|
@ -360,7 +362,7 @@ GLiveSupport :: addToPlaylist(Ptr<const UniqueId>::Ref id) throw ()
|
||||||
Ptr<Playlist>::Ref
|
Ptr<Playlist>::Ref
|
||||||
LiveSupport :: GLiveSupport ::
|
LiveSupport :: GLiveSupport ::
|
||||||
GLiveSupport :: uploadPlaylist(Ptr<const Glib::ustring>::Ref title)
|
GLiveSupport :: uploadPlaylist(Ptr<const Glib::ustring>::Ref title)
|
||||||
throw (StorageException)
|
throw (XmlRpcException)
|
||||||
{
|
{
|
||||||
editedPlaylist->setTitle(title);
|
editedPlaylist->setTitle(title);
|
||||||
|
|
||||||
|
@ -374,3 +376,43 @@ GLiveSupport :: uploadPlaylist(Ptr<const Glib::ustring>::Ref title)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Schedule a playlist, then show the scheduler at that timepoint
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
LiveSupport :: GLiveSupport ::
|
||||||
|
GLiveSupport :: schedulePlaylist(Ptr<Playlist>::Ref playlist,
|
||||||
|
Ptr<posix_time::ptime>::Ref playtime)
|
||||||
|
throw (XmlRpcException)
|
||||||
|
{
|
||||||
|
std::cerr << "schedulePlaylist #1" << std::endl;
|
||||||
|
scheduler->uploadPlaylist(sessionId, playlist->getId(), playtime);
|
||||||
|
std::cerr << "schedulePlaylist #2" << std::endl;
|
||||||
|
masterPanel->updateSchedulerWindow(playtime);
|
||||||
|
std::cerr << "schedulePlaylist #3" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Delete a playable object from the storage.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
LiveSupport :: GLiveSupport ::
|
||||||
|
GLiveSupport :: deletePlayable(Ptr<Playable>::Ref playable)
|
||||||
|
throw (XmlRpcException)
|
||||||
|
{
|
||||||
|
switch (playable->getType()) {
|
||||||
|
case Playable::AudioClipType:
|
||||||
|
storage->deleteAudioClip(sessionId, playable->getId());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Playable::PlaylistType:
|
||||||
|
storage->deletePlaylist(sessionId, playable->getId());
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.13 $
|
Version : $Revision: 1.14 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -95,7 +95,7 @@ class MasterPanelWindow;
|
||||||
* respective documentation.
|
* respective documentation.
|
||||||
*
|
*
|
||||||
* @author $Author: maroy $
|
* @author $Author: maroy $
|
||||||
* @version $Revision: 1.13 $
|
* @version $Revision: 1.14 $
|
||||||
* @see LocalizedObject#getBundle(const xmlpp::Element &)
|
* @see LocalizedObject#getBundle(const xmlpp::Element &)
|
||||||
* @see AuthenticationClientFactory
|
* @see AuthenticationClientFactory
|
||||||
* @see StorageClientFactory
|
* @see StorageClientFactory
|
||||||
|
@ -339,12 +339,12 @@ class GLiveSupport : public LocalizedConfigurable,
|
||||||
* @param title the title of the audio clip.
|
* @param title the title of the audio clip.
|
||||||
* @param fileName the full filename of the audio clip.
|
* @param fileName the full filename of the audio clip.
|
||||||
* @return the audio clip that was uploaded.
|
* @return the audio clip that was uploaded.
|
||||||
* @exception StorageException on upload failures.
|
* @exception XmlRpcException on upload failures.
|
||||||
*/
|
*/
|
||||||
Ptr<AudioClip>::Ref
|
Ptr<AudioClip>::Ref
|
||||||
uploadFile(Ptr<const Glib::ustring>::Ref title,
|
uploadFile(Ptr<const Glib::ustring>::Ref title,
|
||||||
Ptr<const std::string>::Ref fileName)
|
Ptr<const std::string>::Ref fileName)
|
||||||
throw (StorageException);
|
throw (XmlRpcException);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the DJ Bag contents.
|
* Return the DJ Bag contents.
|
||||||
|
@ -385,11 +385,54 @@ class GLiveSupport : public LocalizedConfigurable,
|
||||||
*
|
*
|
||||||
* @param title the title of the audio clip.
|
* @param title the title of the audio clip.
|
||||||
* @return the audio clip that was uploaded.
|
* @return the audio clip that was uploaded.
|
||||||
* @exception StorageException on upload failures.
|
* @exception XmlRpcException on upload failures.
|
||||||
*/
|
*/
|
||||||
Ptr<Playlist>::Ref
|
Ptr<Playlist>::Ref
|
||||||
uploadPlaylist(Ptr<const Glib::ustring>::Ref title)
|
uploadPlaylist(Ptr<const Glib::ustring>::Ref title)
|
||||||
throw (StorageException);
|
throw (XmlRpcException);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the scheduled entries for a specified time interval.
|
||||||
|
*
|
||||||
|
* @param from the start of the interval, inclusive
|
||||||
|
* @param to the end of the interval, exclusive
|
||||||
|
* @return a vector of the schedule entries for the time period.
|
||||||
|
* @exception XmlRpcException in case of XML-RPC errors.
|
||||||
|
*/
|
||||||
|
virtual Ptr<std::vector<Ptr<ScheduleEntry>::Ref> >::Ref
|
||||||
|
displaySchedule(Ptr<boost::posix_time::ptime>::Ref from,
|
||||||
|
Ptr<boost::posix_time::ptime>::Ref to)
|
||||||
|
throw (XmlRpcException)
|
||||||
|
{
|
||||||
|
return scheduler->displaySchedule(sessionId, from, to);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Schedule a playlist.
|
||||||
|
* This will schedule the plalyist, and show the scheduler window
|
||||||
|
* at the time of the scheduled playlist.
|
||||||
|
*
|
||||||
|
* @param playlist the playlist to schedule.
|
||||||
|
* @param playtime the time for when to schedule.
|
||||||
|
* @exception XmlRpcException in case of XML-RPC errors.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
schedulePlaylist(Ptr<Playlist>::Ref playlist,
|
||||||
|
Ptr<boost::posix_time::ptime>::Ref playtime)
|
||||||
|
throw (XmlRpcException);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a playable object from storage.
|
||||||
|
*
|
||||||
|
* @param playable the playable object to delete.
|
||||||
|
* @exception XmlRpcException in case of XML-RPC errors.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
deletePlayable(Ptr<Playable>::Ref playable)
|
||||||
|
throw (XmlRpcException);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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/MasterPanelWindow.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -78,6 +78,7 @@ MasterPanelWindow :: MasterPanelWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
djBagButton.reset(new Gtk::Button("dj bag"));
|
djBagButton.reset(new Gtk::Button("dj bag"));
|
||||||
simplePlaylistMgmtButton.reset(
|
simplePlaylistMgmtButton.reset(
|
||||||
new Gtk::Button("simple playlist management"));
|
new Gtk::Button("simple playlist management"));
|
||||||
|
schedulerButton.reset(new Gtk::Button("scheduler"));
|
||||||
|
|
||||||
// set up the time label
|
// set up the time label
|
||||||
timeWidget.reset(new Gtk::Label("time"));
|
timeWidget.reset(new Gtk::Label("time"));
|
||||||
|
@ -87,17 +88,18 @@ MasterPanelWindow :: MasterPanelWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
|
|
||||||
// set up the main window, and show everything
|
// set up the main window, and show everything
|
||||||
set_border_width(10);
|
set_border_width(10);
|
||||||
layout->attach(*lsLogoWidget, 0, 1, 0, 2);
|
layout->attach(*lsLogoWidget, 0, 1, 0, 2);
|
||||||
layout->attach(*timeWidget, 1, 2, 0, 2);
|
layout->attach(*timeWidget, 1, 2, 0, 2);
|
||||||
layout->attach(*nowPlayingWidget, 2, 3, 0, 2);
|
layout->attach(*nowPlayingWidget, 2, 3, 0, 2);
|
||||||
layout->attach(*vuMeterWidget, 3, 4, 0, 1);
|
layout->attach(*vuMeterWidget, 3, 4, 0, 1);
|
||||||
layout->attach(*nextPlayingWidget, 3, 4, 1, 2);
|
layout->attach(*nextPlayingWidget, 3, 4, 1, 2);
|
||||||
layout->attach(*onAirWidget, 4, 5, 0, 1);
|
layout->attach(*onAirWidget, 4, 5, 0, 1);
|
||||||
layout->attach(*radioLogoWidget, 5, 6, 0, 1);
|
layout->attach(*radioLogoWidget, 5, 6, 0, 1);
|
||||||
layout->attach(*userInfoWidget, 4, 6, 1, 2);
|
layout->attach(*userInfoWidget, 4, 6, 1, 2);
|
||||||
layout->attach(*uploadFileButton, 0, 1, 2, 3);
|
layout->attach(*uploadFileButton, 0, 1, 2, 3);
|
||||||
layout->attach(*djBagButton, 1, 2, 2, 3);
|
layout->attach(*djBagButton, 1, 2, 2, 3);
|
||||||
layout->attach(*simplePlaylistMgmtButton, 2, 3, 2, 3);
|
layout->attach(*simplePlaylistMgmtButton, 2, 3, 2, 3);
|
||||||
|
layout->attach(*schedulerButton, 3, 4, 2, 3);
|
||||||
|
|
||||||
add(*layout);
|
add(*layout);
|
||||||
|
|
||||||
|
@ -114,6 +116,8 @@ MasterPanelWindow :: MasterPanelWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
simplePlaylistMgmtButton->signal_clicked().connect(
|
simplePlaylistMgmtButton->signal_clicked().connect(
|
||||||
sigc::mem_fun(*this,
|
sigc::mem_fun(*this,
|
||||||
&MasterPanelWindow::onSimplePlaylistMgmtButtonClicked));
|
&MasterPanelWindow::onSimplePlaylistMgmtButtonClicked));
|
||||||
|
schedulerButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||||
|
&MasterPanelWindow::onSchedulerButtonClicked));
|
||||||
|
|
||||||
// show what's there to see
|
// show what's there to see
|
||||||
showAnonymousUI();
|
showAnonymousUI();
|
||||||
|
@ -273,6 +277,30 @@ MasterPanelWindow :: onSimplePlaylistMgmtButtonClicked(void) throw ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The event when the Scheduler button has been clicked.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
MasterPanelWindow :: onSchedulerButtonClicked(void) throw ()
|
||||||
|
{
|
||||||
|
if (!schedulerWindow.get()) {
|
||||||
|
Ptr<ResourceBundle>::Ref bundle;
|
||||||
|
try {
|
||||||
|
bundle = getBundle("schedulerWindow");
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
schedulerWindow.reset(new SchedulerWindow(gLiveSupport, bundle));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!schedulerWindow->is_visible()) {
|
||||||
|
schedulerWindow->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Show only the UI components that are visible when no one is logged in
|
* Show only the UI components that are visible when no one is logged in
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
@ -283,6 +311,7 @@ MasterPanelWindow :: showAnonymousUI(void) throw ()
|
||||||
uploadFileButton->hide();
|
uploadFileButton->hide();
|
||||||
djBagButton->hide();
|
djBagButton->hide();
|
||||||
simplePlaylistMgmtButton->hide();
|
simplePlaylistMgmtButton->hide();
|
||||||
|
schedulerButton->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.5 $
|
Version : $Revision: 1.6 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/MasterPanelWindow.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/MasterPanelWindow.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -51,6 +51,7 @@
|
||||||
#include "MasterPanelUserInfoWidget.h"
|
#include "MasterPanelUserInfoWidget.h"
|
||||||
#include "DjBagWindow.h"
|
#include "DjBagWindow.h"
|
||||||
#include "SimplePlaylistManagementWindow.h"
|
#include "SimplePlaylistManagementWindow.h"
|
||||||
|
#include "SchedulerWindow.h"
|
||||||
|
|
||||||
|
|
||||||
namespace LiveSupport {
|
namespace LiveSupport {
|
||||||
|
@ -83,7 +84,7 @@ using namespace LiveSupport::Core;
|
||||||
* </code></pre>
|
* </code></pre>
|
||||||
*
|
*
|
||||||
* @author $Author: maroy $
|
* @author $Author: maroy $
|
||||||
* @version $Revision: 1.5 $
|
* @version $Revision: 1.6 $
|
||||||
*/
|
*/
|
||||||
class MasterPanelWindow : public Gtk::Window, public LocalizedObject
|
class MasterPanelWindow : public Gtk::Window, public LocalizedObject
|
||||||
{
|
{
|
||||||
|
@ -154,6 +155,11 @@ class MasterPanelWindow : public Gtk::Window, public LocalizedObject
|
||||||
*/
|
*/
|
||||||
Ptr<Gtk::Button>::Ref simplePlaylistMgmtButton;
|
Ptr<Gtk::Button>::Ref simplePlaylistMgmtButton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The button to invoke the Scheduler Window.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Button>::Ref schedulerButton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The gLiveSupport object, handling the logic of the application.
|
* The gLiveSupport object, handling the logic of the application.
|
||||||
*/
|
*/
|
||||||
|
@ -169,6 +175,11 @@ class MasterPanelWindow : public Gtk::Window, public LocalizedObject
|
||||||
*/
|
*/
|
||||||
Ptr<SimplePlaylistManagementWindow>::Ref simplePlaylistMgmtWindow;
|
Ptr<SimplePlaylistManagementWindow>::Ref simplePlaylistMgmtWindow;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The one and only scheduler window.
|
||||||
|
*/
|
||||||
|
Ptr<SchedulerWindow>::Ref schedulerWindow;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function that updates timeLabel with the current time.
|
* Function that updates timeLabel with the current time.
|
||||||
* This is called by GTK at regular intervals.
|
* This is called by GTK at regular intervals.
|
||||||
|
@ -215,7 +226,14 @@ class MasterPanelWindow : public Gtk::Window, public LocalizedObject
|
||||||
* Management button being pressed.
|
* Management button being pressed.
|
||||||
*/
|
*/
|
||||||
virtual void
|
virtual void
|
||||||
onSimplePlaylistMgmtButtonClicked(void) throw ();
|
onSimplePlaylistMgmtButtonClicked(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to catch the event of the Scheduler button
|
||||||
|
* button being pressed.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
onSchedulerButtonClicked(void) throw ();
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -283,6 +301,32 @@ class MasterPanelWindow : public Gtk::Window, public LocalizedObject
|
||||||
simplePlaylistMgmtWindow->showContents();
|
simplePlaylistMgmtWindow->showContents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the Scheduler Window
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
updateSchedulerWindow(void) throw ()
|
||||||
|
{
|
||||||
|
// this will create, open and display the window.
|
||||||
|
onSchedulerButtonClicked();
|
||||||
|
schedulerWindow->showContents();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the Scheduler Window to display a new time.
|
||||||
|
*
|
||||||
|
* @param time the time to display in the scheduler window.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
updateSchedulerWindow(Ptr<boost::posix_time::ptime>::Ref time)
|
||||||
|
throw ()
|
||||||
|
{
|
||||||
|
// this will create, open and display the window.
|
||||||
|
onSchedulerButtonClicked();
|
||||||
|
schedulerWindow->setTime(time);
|
||||||
|
schedulerWindow->showContents();
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ================================================= external data structures */
|
/* ================================================= external data structures */
|
||||||
|
|
|
@ -0,0 +1,182 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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/SchedulePlaylistWindow.cxx,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/TimeConversion.h"
|
||||||
|
#include "SchedulePlaylistWindow.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace boost;
|
||||||
|
using namespace Glib;
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
using namespace LiveSupport::GLiveSupport;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Constructor.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
SchedulePlaylistWindow :: SchedulePlaylistWindow (
|
||||||
|
Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
|
Ptr<ResourceBundle>::Ref bundle,
|
||||||
|
Ptr<Playlist>::Ref playlist)
|
||||||
|
throw ()
|
||||||
|
: LocalizedObject(bundle)
|
||||||
|
{
|
||||||
|
this->gLiveSupport = gLiveSupport;
|
||||||
|
this->playlist = playlist;
|
||||||
|
|
||||||
|
try {
|
||||||
|
set_title(*getResourceUstring("windowTitle"));
|
||||||
|
hourLabel.reset(new Gtk::Label(*getResourceUstring("hourLabel")));
|
||||||
|
minuteLabel.reset(new Gtk::Label(*getResourceUstring("minuteLabel")));
|
||||||
|
scheduleButton.reset(new Gtk::Button(
|
||||||
|
*getResourceUstring("scheduleButtonLabel")));
|
||||||
|
closeButton.reset(new Gtk::Button(
|
||||||
|
*getResourceUstring("closeButtonLabel")));
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
playlistLabel.reset(new Gtk::Label(*playlist->getTitle()));
|
||||||
|
calendar.reset(new Gtk::Calendar());
|
||||||
|
hourEntry.reset(new Gtk::Entry());
|
||||||
|
minuteEntry.reset(new Gtk::Entry());
|
||||||
|
|
||||||
|
|
||||||
|
layout.reset(new Gtk::Table());
|
||||||
|
|
||||||
|
layout->attach(*playlistLabel, 0, 4, 0, 1);
|
||||||
|
layout->attach(*calendar, 0, 4, 1, 2);
|
||||||
|
layout->attach(*hourLabel, 0, 1, 2, 3);
|
||||||
|
layout->attach(*hourEntry, 1, 2, 2, 3);
|
||||||
|
layout->attach(*minuteLabel, 2, 3, 2, 3);
|
||||||
|
layout->attach(*minuteEntry, 3, 4, 2, 3);
|
||||||
|
layout->attach(*scheduleButton, 2, 4, 3, 4);
|
||||||
|
layout->attach(*closeButton , 2, 4, 4, 5);
|
||||||
|
|
||||||
|
// register the signal handler for the schedule getting clicked.
|
||||||
|
scheduleButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||||
|
&SchedulePlaylistWindow::onScheduleButtonClicked));
|
||||||
|
// register the signal handler for the button getting clicked.
|
||||||
|
closeButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||||
|
&SchedulePlaylistWindow::onCloseButtonClicked));
|
||||||
|
|
||||||
|
add(*layout);
|
||||||
|
|
||||||
|
show_all();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Destructor.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
SchedulePlaylistWindow :: ~SchedulePlaylistWindow (void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Event handler for the schedule button getting clicked.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
SchedulePlaylistWindow :: onScheduleButtonClicked (void) throw ()
|
||||||
|
{
|
||||||
|
// get the date from the calendar
|
||||||
|
guint year;
|
||||||
|
guint month;
|
||||||
|
guint day;
|
||||||
|
|
||||||
|
calendar->get_date(year, month, day);
|
||||||
|
|
||||||
|
// get the hour and minute from the entries
|
||||||
|
// and construct an HH:MM:00.00 string from it
|
||||||
|
Glib::ustring timeStr = hourEntry->get_text();
|
||||||
|
timeStr += ":";
|
||||||
|
timeStr += minuteEntry->get_text();
|
||||||
|
timeStr += ":00.00";
|
||||||
|
|
||||||
|
Ptr<posix_time::ptime>::Ref selectedTime;
|
||||||
|
|
||||||
|
try {
|
||||||
|
gregorian::date date(year, month+1, day);
|
||||||
|
posix_time::time_duration time(duration_from_string(timeStr.raw()));
|
||||||
|
|
||||||
|
selectedTime.reset(new posix_time::ptime(date, time));
|
||||||
|
} catch (std::exception &e) {
|
||||||
|
// most probably duration_from_string failed
|
||||||
|
// TODO: notify user
|
||||||
|
std::cerr << "date format problem: " << e.what() << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cerr << "selected time: " << *selectedTime << std::endl;
|
||||||
|
std::cerr << "playist: " << playlist->getId()->getId()
|
||||||
|
<< ", " << *playlist->getTitle()
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
|
try {
|
||||||
|
gLiveSupport->schedulePlaylist(playlist, selectedTime);
|
||||||
|
} catch (XmlRpcException &e) {
|
||||||
|
// TODO: notify user
|
||||||
|
std::cerr << "scheduling problem: " << e.what() << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Event handler for the close button getting clicked.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
SchedulePlaylistWindow :: onCloseButtonClicked (void) throw ()
|
||||||
|
{
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,194 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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/SchedulePlaylistWindow.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef SchedulePlaylistWindow_h
|
||||||
|
#define SchedulePlaylistWindow_h
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#error This is a C++ include file
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <boost/date_time/gregorian/gregorian.hpp>
|
||||||
|
|
||||||
|
#include <unicode/resbund.h>
|
||||||
|
|
||||||
|
#include <gtkmm.h>
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/Ptr.h"
|
||||||
|
#include "LiveSupport/Core/LocalizedObject.h"
|
||||||
|
#include "GLiveSupport.h"
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace GLiveSupport {
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The window, for scheduling a specific playlist.
|
||||||
|
*
|
||||||
|
* The rough layout of the window is:
|
||||||
|
* <code><pre>
|
||||||
|
* +--- scheduler window ----------------------------+
|
||||||
|
* | +--- plalyist name ---------------------------+ |
|
||||||
|
* | +--- calendar --------------------------------+ |
|
||||||
|
* | | | |
|
||||||
|
* | +---------------------------------------------+ |
|
||||||
|
* | +--- time input ------------------------------+ |
|
||||||
|
* | | hour: +- hour -+ minute: +- minute -+ | |
|
||||||
|
* | +---------------------------------------------+ |
|
||||||
|
* | +-- schedule button --------------------------+ |
|
||||||
|
* | +-- close button -----------------------------+ |
|
||||||
|
* +-------------------------------------------------+
|
||||||
|
* </pre></code>
|
||||||
|
*
|
||||||
|
* @author $Author: maroy $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
*/
|
||||||
|
class SchedulePlaylistWindow : public Gtk::Window, public LocalizedObject
|
||||||
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The GLiveSupport object, holding the state of the application.
|
||||||
|
*/
|
||||||
|
Ptr<GLiveSupport>::Ref gLiveSupport;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The playlist to schedule.
|
||||||
|
*/
|
||||||
|
Ptr<Playlist>::Ref playlist;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The main container in the window.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Table>::Ref layout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The label displaying the name of the playlist to schedule.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Label>::Ref playlistLabel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The calendar to select a specific date from.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Calendar>::Ref calendar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The hour label.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Label>::Ref hourLabel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The entry field for hour.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Entry>::Ref hourEntry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The minute label.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Label>::Ref minuteLabel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The minute entry field.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Entry>::Ref minuteEntry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The schedule button.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Button>::Ref scheduleButton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The close button.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Button>::Ref closeButton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal handler for the schedule button clicked.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
onScheduleButtonClicked(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal handler for the close button clicked.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
onCloseButtonClicked(void) throw ();
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param gLiveSupport the GLiveSupport, application object.
|
||||||
|
* @param bundle the resource bundle holding the localized
|
||||||
|
* resources for this window
|
||||||
|
* @param playlist the playlist to schedule.
|
||||||
|
*/
|
||||||
|
SchedulePlaylistWindow(Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
|
Ptr<ResourceBundle>::Ref bundle,
|
||||||
|
Ptr<Playlist>::Ref playlist)
|
||||||
|
throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Virtual destructor.
|
||||||
|
*/
|
||||||
|
virtual
|
||||||
|
~SchedulePlaylistWindow(void) throw ();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/* ================================================= external data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace GLiveSupport
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // SchedulePlaylistWindow_h
|
||||||
|
|
|
@ -0,0 +1,222 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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/SchedulerWindow.cxx,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/TimeConversion.h"
|
||||||
|
#include "SchedulerWindow.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace boost;
|
||||||
|
using namespace Glib;
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
using namespace LiveSupport::GLiveSupport;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Constructor.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
SchedulerWindow :: SchedulerWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
|
Ptr<ResourceBundle>::Ref bundle)
|
||||||
|
throw ()
|
||||||
|
: LocalizedObject(bundle)
|
||||||
|
{
|
||||||
|
this->gLiveSupport = gLiveSupport;
|
||||||
|
|
||||||
|
try {
|
||||||
|
set_title(*getResourceUstring("windowTitle"));
|
||||||
|
closeButton.reset(new Gtk::Button(
|
||||||
|
*getResourceUstring("closeButtonLabel")));
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
calendar.reset(new Gtk::Calendar());
|
||||||
|
dateLabel.reset(new Gtk::Label());
|
||||||
|
|
||||||
|
// create the tree view for the entries
|
||||||
|
entryColumns.reset(new ModelColumns());
|
||||||
|
entriesModel = Gtk::ListStore::create(*entryColumns);
|
||||||
|
entriesView.reset(new Gtk::TreeView());
|
||||||
|
entriesView->set_model(entriesModel);
|
||||||
|
|
||||||
|
// Add the TreeView's view columns:
|
||||||
|
try {
|
||||||
|
entriesView->append_column(*getResourceUstring("startColumnLabel"),
|
||||||
|
entryColumns->startColumn);
|
||||||
|
entriesView->append_column(*getResourceUstring("titleColumnLabel"),
|
||||||
|
entryColumns->titleColumn);
|
||||||
|
entriesView->append_column(*getResourceUstring("endColumnLabel"),
|
||||||
|
entryColumns->endColumn);
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
layout.reset(new Gtk::Table());
|
||||||
|
|
||||||
|
layout->attach(*calendar, 0, 1, 0, 1);
|
||||||
|
layout->attach(*dateLabel, 0, 1, 1, 2);
|
||||||
|
layout->attach(*entriesView, 0, 1, 2, 3);
|
||||||
|
|
||||||
|
// register the signal handler for the button getting clicked.
|
||||||
|
closeButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||||
|
&SchedulerWindow::onCloseButtonClicked));
|
||||||
|
// register the signal handle for when a date is selected in the calendar
|
||||||
|
calendar->signal_day_selected().connect(sigc::mem_fun(*this,
|
||||||
|
&SchedulerWindow::onDateSelected));
|
||||||
|
|
||||||
|
// initialize the selected date for today
|
||||||
|
selectedDate.reset(new gregorian::date(TimeConversion::now()->date()));
|
||||||
|
|
||||||
|
add(*layout);
|
||||||
|
|
||||||
|
show_all();
|
||||||
|
|
||||||
|
showContents();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Destructor.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
SchedulerWindow :: ~SchedulerWindow (void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Event handler for a date being selected on the calendar
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
SchedulerWindow :: onDateSelected (void) throw ()
|
||||||
|
{
|
||||||
|
guint year;
|
||||||
|
guint month;
|
||||||
|
guint day;
|
||||||
|
|
||||||
|
calendar->get_date(year, month, day);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Ptr<gregorian::date>::Ref date(new gregorian::date(year, month+1, day));
|
||||||
|
if (*date != *selectedDate) {
|
||||||
|
selectedDate = date;
|
||||||
|
showContents();
|
||||||
|
}
|
||||||
|
} catch (std::out_of_range &e) {
|
||||||
|
// TODO: report error
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Move the time to be displayed to the specified time.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
SchedulerWindow :: setTime(Ptr<boost::posix_time::ptime>::Ref time)
|
||||||
|
throw ()
|
||||||
|
{
|
||||||
|
selectedDate.reset(new gregorian::date(time->date()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Update the contents of the display, with regards to the currently selected
|
||||||
|
* date
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
SchedulerWindow :: showContents(void) throw ()
|
||||||
|
{
|
||||||
|
calendar->select_month(selectedDate->month() - 1, selectedDate->year());
|
||||||
|
calendar->select_day(selectedDate->day());
|
||||||
|
|
||||||
|
dateLabel->set_text(to_simple_string(*selectedDate));
|
||||||
|
|
||||||
|
Ptr<std::vector<Ptr<ScheduleEntry>::Ref> >::Ref entries;
|
||||||
|
std::vector<Ptr<ScheduleEntry>::Ref>::iterator it;
|
||||||
|
std::vector<Ptr<ScheduleEntry>::Ref>::iterator end;
|
||||||
|
Ptr<posix_time::ptime>::Ref from;
|
||||||
|
Ptr<posix_time::ptime>::Ref to;
|
||||||
|
Ptr<posix_time::time_duration>::Ref midnight;
|
||||||
|
|
||||||
|
// we're interested from midnight, selectedDate, to midnight, the next day
|
||||||
|
midnight.reset(new posix_time::time_duration(0, 0, 0, 0));
|
||||||
|
from.reset(new posix_time::ptime(*selectedDate, *midnight));
|
||||||
|
to.reset(new posix_time::ptime(*selectedDate + gregorian::date_duration(1),
|
||||||
|
*midnight));
|
||||||
|
|
||||||
|
entries = gLiveSupport->displaySchedule(from, to);
|
||||||
|
it = entries->begin();
|
||||||
|
end = entries->end();
|
||||||
|
entriesModel->clear();
|
||||||
|
while (it != end) {
|
||||||
|
Ptr<ScheduleEntry>::Ref entry = *it;
|
||||||
|
Gtk::TreeModel::Row row = *(entriesModel->append());
|
||||||
|
|
||||||
|
row[entryColumns->idColumn] = entry->getId();
|
||||||
|
row[entryColumns->startColumn] =
|
||||||
|
to_simple_string(*entry->getStartTime());
|
||||||
|
// TODO: get the title
|
||||||
|
row[entryColumns->titleColumn] = "title here";
|
||||||
|
row[entryColumns->endColumn] = to_simple_string(*entry->getEndTime());
|
||||||
|
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Event handler for the close button getting clicked.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
SchedulerWindow :: onCloseButtonClicked (void) throw ()
|
||||||
|
{
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,245 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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/SchedulerWindow.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef SchedulerWindow_h
|
||||||
|
#define SchedulerWindow_h
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#error This is a C++ include file
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <boost/date_time/gregorian/gregorian.hpp>
|
||||||
|
|
||||||
|
#include <unicode/resbund.h>
|
||||||
|
|
||||||
|
#include <gtkmm.h>
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/Ptr.h"
|
||||||
|
#include "LiveSupport/Core/LocalizedObject.h"
|
||||||
|
#include "GLiveSupport.h"
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace GLiveSupport {
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Scheduler window, showing and allowing scheduling of playlists.
|
||||||
|
*
|
||||||
|
* The rough layout of the window is:
|
||||||
|
* <code><pre>
|
||||||
|
* +--- scheduler window ----------------------------+
|
||||||
|
* | +--- calendar --------------------------------+ |
|
||||||
|
* | | | |
|
||||||
|
* | +---------------------------------------------+ |
|
||||||
|
* | +--- the selected day ------------------------+ |
|
||||||
|
* | +--- entires for the selected day ------------+ |
|
||||||
|
* | | +--- entry 1 -----------------------------+ | |
|
||||||
|
* | | | +-- start --+ +-- title --+ +-- end --+ | | |
|
||||||
|
* | | +-----------------------------------------+ | |
|
||||||
|
* | | +--- entry 2 -----------------------------+ | |
|
||||||
|
* | | | +-- start --+ +-- title --+ +-- end --+ | | |
|
||||||
|
* | | +-----------------------------------------+ | |
|
||||||
|
* | +---------------------------------------------+ |
|
||||||
|
* | +-- close button -----------------------------+ |
|
||||||
|
* +-------------------------------------------------+
|
||||||
|
* </pre></code>
|
||||||
|
*
|
||||||
|
* @author $Author: maroy $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
*/
|
||||||
|
class SchedulerWindow : public Gtk::Window, public LocalizedObject
|
||||||
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The columns model needed by Gtk::TreeView.
|
||||||
|
* Lists one scheduled item 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<Ptr<const UniqueId>::Ref> idColumn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The column for the start of the playlist.
|
||||||
|
*/
|
||||||
|
Gtk::TreeModelColumn<Glib::ustring> startColumn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The column for the title of the playlist.
|
||||||
|
*/
|
||||||
|
Gtk::TreeModelColumn<Glib::ustring> titleColumn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The column for the end of the playlist.
|
||||||
|
*/
|
||||||
|
Gtk::TreeModelColumn<Glib::ustring> endColumn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
ModelColumns(void) throw ()
|
||||||
|
{
|
||||||
|
add(idColumn);
|
||||||
|
add(startColumn);
|
||||||
|
add(titleColumn);
|
||||||
|
add(endColumn);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The GLiveSupport object, holding the state of the application.
|
||||||
|
*/
|
||||||
|
Ptr<GLiveSupport>::Ref gLiveSupport;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The date selected for display.
|
||||||
|
*/
|
||||||
|
Ptr<boost::gregorian::date>::Ref selectedDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The main container in the window.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Table>::Ref layout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The calendar to select a specific date from.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Calendar>::Ref calendar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The label saying which day is being displayed.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Label>::Ref dateLabel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The column model.
|
||||||
|
*/
|
||||||
|
Ptr<ModelColumns>::Ref entryColumns;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The tree view, now only showing rows, each scheduled entry for a
|
||||||
|
* specific day.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::TreeView>::Ref entriesView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The tree model, as a GTK reference.
|
||||||
|
*/
|
||||||
|
Glib::RefPtr<Gtk::ListStore> entriesModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The close button.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Button>::Ref closeButton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal handler for when a date is selected in the calendar.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
onDateSelected(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal handler for the close button clicked.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
onCloseButtonClicked(void) throw ();
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param gLiveSupport the GLiveSupport, application object.
|
||||||
|
* @param bundle the resource bundle holding the localized
|
||||||
|
* resources for this window
|
||||||
|
*/
|
||||||
|
SchedulerWindow(Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
|
Ptr<ResourceBundle>::Ref bundle) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Virtual destructor.
|
||||||
|
*/
|
||||||
|
virtual
|
||||||
|
~SchedulerWindow(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select a specific timepoint to display.
|
||||||
|
* Call showContents() after this call.
|
||||||
|
*
|
||||||
|
* @param time display the schedule around this timepoint.
|
||||||
|
* @see #showContents
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
setTime(Ptr<boost::posix_time::ptime>::Ref time) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the display, with regards to the currently selected day.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
showContents(void) throw ();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/* ================================================= external data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace GLiveSupport
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // SchedulerWindow_h
|
||||||
|
|
|
@ -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/SimplePlaylistManagementWindow.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -150,7 +150,7 @@ SimplePlaylistManagementWindow :: onSaveButtonClicked (void) throw ()
|
||||||
Glib::ustring statusText("uploaded playlist ");
|
Glib::ustring statusText("uploaded playlist ");
|
||||||
statusText += *playlist->getTitle();
|
statusText += *playlist->getTitle();
|
||||||
statusBar->set_text(statusText);
|
statusBar->set_text(statusText);
|
||||||
} catch (StorageException &e) {
|
} catch (XmlRpcException &e) {
|
||||||
statusBar->set_text(e.what());
|
statusBar->set_text(e.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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/UploadFileWindow.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/UploadFileWindow.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -155,7 +155,7 @@ UploadFileWindow :: onUploadButtonClicked(void) throw ()
|
||||||
// clean the entry fields
|
// clean the entry fields
|
||||||
nameEntry->set_text("");
|
nameEntry->set_text("");
|
||||||
fileNameEntry->set_text("");
|
fileNameEntry->set_text("");
|
||||||
} catch (StorageException &e) {
|
} catch (XmlRpcException &e) {
|
||||||
statusBar->set_text(e.what());
|
statusBar->set_text(e.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,8 +35,10 @@ root:table
|
||||||
titleColumnLabel:string { "title" }
|
titleColumnLabel:string { "title" }
|
||||||
closeButtonLabel:string { "close" }
|
closeButtonLabel:string { "close" }
|
||||||
|
|
||||||
removeMenuItem:string { "_Remove" }
|
removeMenuItem:string { "_Remove" }
|
||||||
addToPlaylistMenuItem:string { "_Add To Playlist" }
|
addToPlaylistMenuItem:string { "_Add To Playlist" }
|
||||||
|
schedulePlaylistMenuItem:string { "_Schedule Playlist" }
|
||||||
|
deleteMenuItem:string { "_Delete" }
|
||||||
}
|
}
|
||||||
|
|
||||||
playlistListWindow:table
|
playlistListWindow:table
|
||||||
|
@ -64,5 +66,27 @@ root:table
|
||||||
closeButtonLabel:string { "close" }
|
closeButtonLabel:string { "close" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
schedulerWindow:table
|
||||||
|
{
|
||||||
|
windowTitle:string { "LiveSupport Scheduler Window" }
|
||||||
|
|
||||||
|
startColumnLabel:string { "start" }
|
||||||
|
titleColumnLabel:string { "title" }
|
||||||
|
endColumnLabel:string { "end" }
|
||||||
|
|
||||||
|
closeButtonLabel:string { "close" }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
schedulePlaylistWindow:table
|
||||||
|
{
|
||||||
|
windowTitle:string { "LiveSupport Schedule Playlist Window" }
|
||||||
|
|
||||||
|
hourLabel:string { "hour: " }
|
||||||
|
minuteLabel:string { "minute: " }
|
||||||
|
scheduleButtonLabel:string { "schedule" }
|
||||||
|
closeButtonLabel:string { "close" }
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue