From f99bc8bc40a05a3d230f96d5679d0e46f290a134 Mon Sep 17 00:00:00 2001 From: maroy Date: Sun, 9 Jan 2005 10:58:32 +0000 Subject: [PATCH] added SchedulePlaylistWindow and SchedulerWindow and lots of other changes --- .../products/gLiveSupport/etc/Makefile.in | 29 ++- .../gLiveSupport/etc/gLiveSupport.xml | 61 ++--- .../products/gLiveSupport/src/DjBagWindow.cxx | 159 ++++++++++-- .../products/gLiveSupport/src/DjBagWindow.h | 47 +++- .../gLiveSupport/src/GLiveSupport.cxx | 50 +++- .../products/gLiveSupport/src/GLiveSupport.h | 55 +++- .../gLiveSupport/src/MasterPanelWindow.cxx | 53 +++- .../gLiveSupport/src/MasterPanelWindow.h | 50 +++- .../src/SchedulePlaylistWindow.cxx | 182 +++++++++++++ .../gLiveSupport/src/SchedulePlaylistWindow.h | 194 ++++++++++++++ .../gLiveSupport/src/SchedulerWindow.cxx | 222 ++++++++++++++++ .../gLiveSupport/src/SchedulerWindow.h | 245 ++++++++++++++++++ .../src/SimplePlaylistManagementWindow.cxx | 4 +- .../gLiveSupport/src/UploadFileWindow.cxx | 4 +- .../products/gLiveSupport/var/root.txt | 28 +- 15 files changed, 1279 insertions(+), 104 deletions(-) create mode 100644 livesupport/products/gLiveSupport/src/SchedulePlaylistWindow.cxx create mode 100644 livesupport/products/gLiveSupport/src/SchedulePlaylistWindow.h create mode 100644 livesupport/products/gLiveSupport/src/SchedulerWindow.cxx create mode 100644 livesupport/products/gLiveSupport/src/SchedulerWindow.h diff --git a/livesupport/products/gLiveSupport/etc/Makefile.in b/livesupport/products/gLiveSupport/etc/Makefile.in index 70ddd5b50..a0d01b6e4 100644 --- a/livesupport/products/gLiveSupport/etc/Makefile.in +++ b/livesupport/products/gLiveSupport/etc/Makefile.in @@ -21,7 +21,7 @@ # # # 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 $ # # @configure_input@ @@ -70,7 +70,13 @@ GENRBOPTS = --destdir ${TMP_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_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 = livesupport_playlist_executor PLAYLIST_EXECUTOR_LIB_FILE = ${PLAYLIST_EXECUTOR_LIB_DIR}/lib${PLAYLIST_EXECUTOR_LIB}.a + LIBXMLPP_CFLAGS=@LIBXMLPP_CFLAGS@ LIBXMLPP_LIBS=@LIBXMLPP_LIBS@ @@ -169,7 +176,9 @@ G_LIVESUPPORT_OBJS = ${TMP_DIR}/GLiveSupport.o \ ${TMP_DIR}/PlaylistListWindow.o \ ${TMP_DIR}/UploadFileWindow.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 \ ${TMP_DIR}/${PACKAGE_NAME}_en.res \ @@ -234,6 +243,20 @@ run_tests: ${TEST_RUNNER} run: all ${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 diff --git a/livesupport/products/gLiveSupport/etc/gLiveSupport.xml b/livesupport/products/gLiveSupport/etc/gLiveSupport.xml index a4093381b..fe8a319e6 100644 --- a/livesupport/products/gLiveSupport/etc/gLiveSupport.xml +++ b/livesupport/products/gLiveSupport/etc/gLiveSupport.xml @@ -23,6 +23,13 @@ + + + + + + + @@ -54,11 +61,6 @@ - - - - - @@ -83,50 +85,17 @@ - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + diff --git a/livesupport/products/gLiveSupport/src/DjBagWindow.cxx b/livesupport/products/gLiveSupport/src/DjBagWindow.cxx index 3728afbe9..8d9751609 100644 --- a/livesupport/products/gLiveSupport/src/DjBagWindow.cxx +++ b/livesupport/products/gLiveSupport/src/DjBagWindow.cxx @@ -22,7 +22,7 @@ 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 $ ------------------------------------------------------------------------------*/ @@ -36,6 +36,7 @@ #include #include +#include "SchedulePlaylistWindow.h" #include "DjBagWindow.h" @@ -119,19 +120,45 @@ DjBagWindow :: DjBagWindow (Ptr::Ref gLiveSupport, &DjBagWindow::onEntryClicked)); - // create the right-click entry context menu - entryMenu.reset(new Gtk::Menu()); - Gtk::Menu::MenuList& menuList = entryMenu->items(); + // create the right-click entry context menu for audio clips + audioClipMenu.reset(new Gtk::Menu()); + Gtk::Menu::MenuList& audioClipMenuList = audioClipMenu->items(); // register the signal handlers for the popup menu - menuList.push_back(Gtk::Menu_Helpers::MenuElem( + audioClipMenuList.push_back(Gtk::Menu_Helpers::MenuElem( *getResourceUstring("addToPlaylistMenuItem"), sigc::mem_fun(*this, &DjBagWindow::onAddToPlaylist))); - menuList.push_back(Gtk::Menu_Helpers::MenuElem( + audioClipMenuList.push_back(Gtk::Menu_Helpers::MenuElem( *getResourceUstring("removeMenuItem"), sigc::mem_fun(*this, &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 showContents(); @@ -160,16 +187,18 @@ DjBagWindow :: showContents(void) throw () playable = *it; row = *(treeModel->append()); - row[modelColumns.idColumn] = playable->getId(); + row[modelColumns.playableColumn] = playable; switch (playable->getType()) { case Playable::AudioClipType: - default: row[modelColumns.typeColumn] = "audioclip"; break; case Playable::PlaylistType: row[modelColumns.typeColumn] = "playlist"; break; + + default: + break; } row[modelColumns.titleColumn] = *playable->getTitle(); @@ -207,8 +236,23 @@ DjBagWindow :: onEntryClicked (GdkEventButton * event) throw () Glib::RefPtr refSelection = treeView.get_selection(); if (refSelection) { - if (refSelection->get_selected()) { - entryMenu->popup(event->button, event->time); + Gtk::TreeModel::iterator iter = refSelection->get_selected(); + if (iter) { + Ptr::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) { Gtk::TreeModel::iterator iter = refSelection->get_selected(); if (iter) { - Ptr::Ref id = (*iter)[modelColumns.idColumn]; + Ptr::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 refSelection = + treeView.get_selection(); + + if (refSelection) { + Gtk::TreeModel::iterator iter = refSelection->get_selected(); + if (iter) { + Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; + + try { + deleteItem(playable); + } catch (XmlRpcException &e) { + // TODO: signal error here + } showContents(); } } @@ -262,6 +331,18 @@ DjBagWindow :: removeItem(Ptr::Ref id) throw () } +/*------------------------------------------------------------------------------ + * Delete an item from storage, and remove it from the dj bag + *----------------------------------------------------------------------------*/ +void +DjBagWindow :: deleteItem(Ptr::Ref playable) + throw (XmlRpcException) +{ + gLiveSupport->deletePlayable(playable); + removeItem(playable->getId()); +} + + /*------------------------------------------------------------------------------ * Event handler for the Add To Playlist menu item selected from the * entry conext menu @@ -275,9 +356,57 @@ DjBagWindow :: onAddToPlaylist(void) throw () if (refSelection) { Gtk::TreeModel::iterator iter = refSelection->get_selected(); if (iter) { - Ptr::Ref id = (*iter)[modelColumns.idColumn]; + Ptr::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 refSelection = + treeView.get_selection(); + + if (refSelection) { + Gtk::TreeModel::iterator iter = refSelection->get_selected(); + if (iter) { + Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; + Ptr::Ref uid = playable->getId(); + + Ptr::Ref sessionId = + gLiveSupport->getSessionId(); + Ptr::Ref storage = + gLiveSupport->getStorage(); + + // append the appropriate playable object to the end of the playlist + if (!storage->existsPlaylist(sessionId, uid)) { + return; + } + + Ptr::Ref playlist = storage->getPlaylist(sessionId, uid); + + Ptr::Ref bundle; + try { + bundle = gLiveSupport->getBundle("schedulePlaylistWindow"); + } catch (std::invalid_argument &e) { + std::cerr << e.what() << std::endl; + return; + } + + Ptr::Ref scheduleWindow; + + scheduleWindow.reset(new SchedulePlaylistWindow(gLiveSupport, + bundle, + playlist)); + + Gtk::Main::run(*scheduleWindow); } } } diff --git a/livesupport/products/gLiveSupport/src/DjBagWindow.h b/livesupport/products/gLiveSupport/src/DjBagWindow.h index 9e72e2e4c..cf69dd20d 100644 --- a/livesupport/products/gLiveSupport/src/DjBagWindow.h +++ b/livesupport/products/gLiveSupport/src/DjBagWindow.h @@ -22,7 +22,7 @@ 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 $ ------------------------------------------------------------------------------*/ @@ -68,7 +68,7 @@ using namespace LiveSupport::Core; * playlists. * * @author $Author: maroy $ - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ */ class DjBagWindow : public Gtk::Window, public LocalizedObject { @@ -80,15 +80,15 @@ class DjBagWindow : public Gtk::Window, public LocalizedObject * Lists one clip per row. * * @author $Author: maroy $ - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ */ class ModelColumns : public Gtk::TreeModel::ColumnRecord { public: /** - * The column for the id of the audio clip or playlist. + * The column for the playable object shown in the row. */ - Gtk::TreeModelColumn::Ref> idColumn; + Gtk::TreeModelColumn::Ref> playableColumn; /** * 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 () { - add(idColumn); + add(playableColumn); add(typeColumn); add(titleColumn); } @@ -153,10 +153,16 @@ class DjBagWindow : public Gtk::Window, public LocalizedObject Ptr::Ref closeButton; /** - * The right-click context menu, that comes up when right-clicking - * an entry in the entry list. + * The right-click context menu for audio clips, + * that comes up when right-clicking an entry in the entry list. */ - Ptr::Ref entryMenu; + Ptr::Ref audioClipMenu; + + /** + * The right-click context menu for playlists, + * that comes up when right-clicking an entry in the entry list. + */ + Ptr::Ref playlistMenu; /** * Signal handler for the close button clicked. @@ -179,6 +185,13 @@ class DjBagWindow : public Gtk::Window, public LocalizedObject virtual void 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 * the entry context menu. @@ -186,6 +199,22 @@ class DjBagWindow : public Gtk::Window, public LocalizedObject virtual void 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::Ref playable) throw (XmlRpcException); + public: /** diff --git a/livesupport/products/gLiveSupport/src/GLiveSupport.cxx b/livesupport/products/gLiveSupport/src/GLiveSupport.cxx index e2bd03296..daa9b2a4d 100644 --- a/livesupport/products/gLiveSupport/src/GLiveSupport.cxx +++ b/livesupport/products/gLiveSupport/src/GLiveSupport.cxx @@ -22,7 +22,7 @@ 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 $ ------------------------------------------------------------------------------*/ @@ -46,6 +46,8 @@ #include "GLiveSupport.h" +using namespace boost; + using namespace LiveSupport::Core; using namespace LiveSupport::Authentication; using namespace LiveSupport::Storage; @@ -296,7 +298,7 @@ Ptr::Ref LiveSupport :: GLiveSupport :: GLiveSupport :: uploadFile(Ptr::Ref title, Ptr::Ref fileName) - throw (StorageException) + throw (XmlRpcException) { // create a URI from the file name Ptr::Ref uri(new std::string("file://")); @@ -309,7 +311,7 @@ GLiveSupport :: uploadFile(Ptr::Ref title, playlength = audioPlayer->getPlaylength(); audioPlayer->close(); } catch (std::invalid_argument &e) { - throw StorageException(e.what()); + throw XmlRpcException(e.what()); } // create and upload an AudioClip object @@ -360,7 +362,7 @@ GLiveSupport :: addToPlaylist(Ptr::Ref id) throw () Ptr::Ref LiveSupport :: GLiveSupport :: GLiveSupport :: uploadPlaylist(Ptr::Ref title) - throw (StorageException) + throw (XmlRpcException) { editedPlaylist->setTitle(title); @@ -374,3 +376,43 @@ GLiveSupport :: uploadPlaylist(Ptr::Ref title) } +/*------------------------------------------------------------------------------ + * Schedule a playlist, then show the scheduler at that timepoint + *----------------------------------------------------------------------------*/ +void +LiveSupport :: GLiveSupport :: +GLiveSupport :: schedulePlaylist(Ptr::Ref playlist, + Ptr::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::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; + } +} + + diff --git a/livesupport/products/gLiveSupport/src/GLiveSupport.h b/livesupport/products/gLiveSupport/src/GLiveSupport.h index 9a35bbebe..0a71971d5 100644 --- a/livesupport/products/gLiveSupport/src/GLiveSupport.h +++ b/livesupport/products/gLiveSupport/src/GLiveSupport.h @@ -22,7 +22,7 @@ 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 $ ------------------------------------------------------------------------------*/ @@ -95,7 +95,7 @@ class MasterPanelWindow; * respective documentation. * * @author $Author: maroy $ - * @version $Revision: 1.13 $ + * @version $Revision: 1.14 $ * @see LocalizedObject#getBundle(const xmlpp::Element &) * @see AuthenticationClientFactory * @see StorageClientFactory @@ -339,12 +339,12 @@ class GLiveSupport : public LocalizedConfigurable, * @param title the title of the audio clip. * @param fileName the full filename of the audio clip. * @return the audio clip that was uploaded. - * @exception StorageException on upload failures. + * @exception XmlRpcException on upload failures. */ Ptr::Ref uploadFile(Ptr::Ref title, Ptr::Ref fileName) - throw (StorageException); + throw (XmlRpcException); /** * Return the DJ Bag contents. @@ -385,11 +385,54 @@ class GLiveSupport : public LocalizedConfigurable, * * @param title the title of the audio clip. * @return the audio clip that was uploaded. - * @exception StorageException on upload failures. + * @exception XmlRpcException on upload failures. */ Ptr::Ref uploadPlaylist(Ptr::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::Ref> >::Ref + displaySchedule(Ptr::Ref from, + Ptr::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::Ref playlist, + Ptr::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::Ref playable) + throw (XmlRpcException); + }; diff --git a/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx b/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx index 7142446a4..700ce20b9 100644 --- a/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx +++ b/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx @@ -22,7 +22,7 @@ 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 $ ------------------------------------------------------------------------------*/ @@ -78,6 +78,7 @@ MasterPanelWindow :: MasterPanelWindow (Ptr::Ref gLiveSupport, djBagButton.reset(new Gtk::Button("dj bag")); simplePlaylistMgmtButton.reset( new Gtk::Button("simple playlist management")); + schedulerButton.reset(new Gtk::Button("scheduler")); // set up the time label timeWidget.reset(new Gtk::Label("time")); @@ -87,17 +88,18 @@ MasterPanelWindow :: MasterPanelWindow (Ptr::Ref gLiveSupport, // set up the main window, and show everything set_border_width(10); - layout->attach(*lsLogoWidget, 0, 1, 0, 2); - layout->attach(*timeWidget, 1, 2, 0, 2); - layout->attach(*nowPlayingWidget, 2, 3, 0, 2); - layout->attach(*vuMeterWidget, 3, 4, 0, 1); - layout->attach(*nextPlayingWidget, 3, 4, 1, 2); - layout->attach(*onAirWidget, 4, 5, 0, 1); - layout->attach(*radioLogoWidget, 5, 6, 0, 1); - layout->attach(*userInfoWidget, 4, 6, 1, 2); - layout->attach(*uploadFileButton, 0, 1, 2, 3); - layout->attach(*djBagButton, 1, 2, 2, 3); - layout->attach(*simplePlaylistMgmtButton, 2, 3, 2, 3); + layout->attach(*lsLogoWidget, 0, 1, 0, 2); + layout->attach(*timeWidget, 1, 2, 0, 2); + layout->attach(*nowPlayingWidget, 2, 3, 0, 2); + layout->attach(*vuMeterWidget, 3, 4, 0, 1); + layout->attach(*nextPlayingWidget, 3, 4, 1, 2); + layout->attach(*onAirWidget, 4, 5, 0, 1); + layout->attach(*radioLogoWidget, 5, 6, 0, 1); + layout->attach(*userInfoWidget, 4, 6, 1, 2); + layout->attach(*uploadFileButton, 0, 1, 2, 3); + layout->attach(*djBagButton, 1, 2, 2, 3); + layout->attach(*simplePlaylistMgmtButton, 2, 3, 2, 3); + layout->attach(*schedulerButton, 3, 4, 2, 3); add(*layout); @@ -114,6 +116,8 @@ MasterPanelWindow :: MasterPanelWindow (Ptr::Ref gLiveSupport, simplePlaylistMgmtButton->signal_clicked().connect( sigc::mem_fun(*this, &MasterPanelWindow::onSimplePlaylistMgmtButtonClicked)); + schedulerButton->signal_clicked().connect(sigc::mem_fun(*this, + &MasterPanelWindow::onSchedulerButtonClicked)); // show what's there to see 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::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 *----------------------------------------------------------------------------*/ @@ -283,6 +311,7 @@ MasterPanelWindow :: showAnonymousUI(void) throw () uploadFileButton->hide(); djBagButton->hide(); simplePlaylistMgmtButton->hide(); + schedulerButton->hide(); } diff --git a/livesupport/products/gLiveSupport/src/MasterPanelWindow.h b/livesupport/products/gLiveSupport/src/MasterPanelWindow.h index aafabebd5..705ec1bb5 100644 --- a/livesupport/products/gLiveSupport/src/MasterPanelWindow.h +++ b/livesupport/products/gLiveSupport/src/MasterPanelWindow.h @@ -22,7 +22,7 @@ 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 $ ------------------------------------------------------------------------------*/ @@ -51,6 +51,7 @@ #include "MasterPanelUserInfoWidget.h" #include "DjBagWindow.h" #include "SimplePlaylistManagementWindow.h" +#include "SchedulerWindow.h" namespace LiveSupport { @@ -83,7 +84,7 @@ using namespace LiveSupport::Core; * * * @author $Author: maroy $ - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ */ class MasterPanelWindow : public Gtk::Window, public LocalizedObject { @@ -154,6 +155,11 @@ class MasterPanelWindow : public Gtk::Window, public LocalizedObject */ Ptr::Ref simplePlaylistMgmtButton; + /** + * The button to invoke the Scheduler Window. + */ + Ptr::Ref schedulerButton; + /** * The gLiveSupport object, handling the logic of the application. */ @@ -169,6 +175,11 @@ class MasterPanelWindow : public Gtk::Window, public LocalizedObject */ Ptr::Ref simplePlaylistMgmtWindow; + /** + * The one and only scheduler window. + */ + Ptr::Ref schedulerWindow; + /** * Function that updates timeLabel with the current time. * This is called by GTK at regular intervals. @@ -215,7 +226,14 @@ class MasterPanelWindow : public Gtk::Window, public LocalizedObject * Management button being pressed. */ 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: @@ -283,6 +301,32 @@ class MasterPanelWindow : public Gtk::Window, public LocalizedObject 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::Ref time) + throw () + { + // this will create, open and display the window. + onSchedulerButtonClicked(); + schedulerWindow->setTime(time); + schedulerWindow->showContents(); + } + }; /* ================================================= external data structures */ diff --git a/livesupport/products/gLiveSupport/src/SchedulePlaylistWindow.cxx b/livesupport/products/gLiveSupport/src/SchedulePlaylistWindow.cxx new file mode 100644 index 000000000..a5b1ede5a --- /dev/null +++ b/livesupport/products/gLiveSupport/src/SchedulePlaylistWindow.cxx @@ -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 +#include + +#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::Ref gLiveSupport, + Ptr::Ref bundle, + Ptr::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::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(); +} + + diff --git a/livesupport/products/gLiveSupport/src/SchedulePlaylistWindow.h b/livesupport/products/gLiveSupport/src/SchedulePlaylistWindow.h new file mode 100644 index 000000000..c9dfc578f --- /dev/null +++ b/livesupport/products/gLiveSupport/src/SchedulePlaylistWindow.h @@ -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 + +#include + +#include + +#include + +#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: + *
+ *  +--- scheduler window ----------------------------+
+ *  | +--- plalyist name ---------------------------+ |
+ *  | +--- calendar --------------------------------+ |
+ *  | |                                             | |
+ *  | +---------------------------------------------+ |
+ *  | +--- time input ------------------------------+ |
+ *  | | hour: +- hour -+  minute: +- minute -+      | |
+ *  | +---------------------------------------------+ |
+ *  | +-- schedule button --------------------------+ |
+ *  | +-- close button -----------------------------+ |
+ *  +-------------------------------------------------+
+ *  
+ * + * @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::Ref gLiveSupport; + + /** + * The playlist to schedule. + */ + Ptr::Ref playlist; + + /** + * The main container in the window. + */ + Ptr::Ref layout; + + /** + * The label displaying the name of the playlist to schedule. + */ + Ptr::Ref playlistLabel; + + /** + * The calendar to select a specific date from. + */ + Ptr::Ref calendar; + + /** + * The hour label. + */ + Ptr::Ref hourLabel; + + /** + * The entry field for hour. + */ + Ptr::Ref hourEntry; + + /** + * The minute label. + */ + Ptr::Ref minuteLabel; + + /** + * The minute entry field. + */ + Ptr::Ref minuteEntry; + + /** + * The schedule button. + */ + Ptr::Ref scheduleButton; + + /** + * The close button. + */ + Ptr::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::Ref gLiveSupport, + Ptr::Ref bundle, + Ptr::Ref playlist) + throw (); + + /** + * Virtual destructor. + */ + virtual + ~SchedulePlaylistWindow(void) throw (); + +}; + +/* ================================================= external data structures */ + + +/* ====================================================== function prototypes */ + + +} // namespace GLiveSupport +} // namespace LiveSupport + +#endif // SchedulePlaylistWindow_h + diff --git a/livesupport/products/gLiveSupport/src/SchedulerWindow.cxx b/livesupport/products/gLiveSupport/src/SchedulerWindow.cxx new file mode 100644 index 000000000..77b17c995 --- /dev/null +++ b/livesupport/products/gLiveSupport/src/SchedulerWindow.cxx @@ -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 +#include + +#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::Ref gLiveSupport, + Ptr::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::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::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::Ref> >::Ref entries; + std::vector::Ref>::iterator it; + std::vector::Ref>::iterator end; + Ptr::Ref from; + Ptr::Ref to; + Ptr::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::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(); +} + + diff --git a/livesupport/products/gLiveSupport/src/SchedulerWindow.h b/livesupport/products/gLiveSupport/src/SchedulerWindow.h new file mode 100644 index 000000000..21dff0139 --- /dev/null +++ b/livesupport/products/gLiveSupport/src/SchedulerWindow.h @@ -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 + +#include + +#include + +#include + +#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: + *
+ *  +--- scheduler window ----------------------------+
+ *  | +--- calendar --------------------------------+ |
+ *  | |                                             | |
+ *  | +---------------------------------------------+ |
+ *  | +--- the selected day ------------------------+ |
+ *  | +--- entires for the selected day ------------+ |
+ *  | | +--- entry 1 -----------------------------+ | |
+ *  | | | +-- start --+ +-- title --+ +-- end --+ | | |
+ *  | | +-----------------------------------------+ | |
+ *  | | +--- entry 2 -----------------------------+ | |
+ *  | | | +-- start --+ +-- title --+ +-- end --+ | | |
+ *  | | +-----------------------------------------+ | |
+ *  | +---------------------------------------------+ |
+ *  | +-- close button -----------------------------+ |
+ *  +-------------------------------------------------+
+ *  
+ * + * @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::Ref> idColumn; + + /** + * The column for the start of the playlist. + */ + Gtk::TreeModelColumn startColumn; + + /** + * The column for the title of the playlist. + */ + Gtk::TreeModelColumn titleColumn; + + /** + * The column for the end of the playlist. + */ + Gtk::TreeModelColumn endColumn; + + /** + * Constructor. + */ + ModelColumns(void) throw () + { + add(idColumn); + add(startColumn); + add(titleColumn); + add(endColumn); + } + }; + + + /** + * The GLiveSupport object, holding the state of the application. + */ + Ptr::Ref gLiveSupport; + + /** + * The date selected for display. + */ + Ptr::Ref selectedDate; + + /** + * The main container in the window. + */ + Ptr::Ref layout; + + /** + * The calendar to select a specific date from. + */ + Ptr::Ref calendar; + + /** + * The label saying which day is being displayed. + */ + Ptr::Ref dateLabel; + + /** + * The column model. + */ + Ptr::Ref entryColumns; + + /** + * The tree view, now only showing rows, each scheduled entry for a + * specific day. + */ + Ptr::Ref entriesView; + + /** + * The tree model, as a GTK reference. + */ + Glib::RefPtr entriesModel; + + /** + * The close button. + */ + Ptr::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::Ref gLiveSupport, + Ptr::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::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 + diff --git a/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx b/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx index 45940caab..71c6e5db4 100644 --- a/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx +++ b/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx @@ -22,7 +22,7 @@ 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 $ ------------------------------------------------------------------------------*/ @@ -150,7 +150,7 @@ SimplePlaylistManagementWindow :: onSaveButtonClicked (void) throw () Glib::ustring statusText("uploaded playlist "); statusText += *playlist->getTitle(); statusBar->set_text(statusText); - } catch (StorageException &e) { + } catch (XmlRpcException &e) { statusBar->set_text(e.what()); } } diff --git a/livesupport/products/gLiveSupport/src/UploadFileWindow.cxx b/livesupport/products/gLiveSupport/src/UploadFileWindow.cxx index 1c05bc61f..59d070353 100644 --- a/livesupport/products/gLiveSupport/src/UploadFileWindow.cxx +++ b/livesupport/products/gLiveSupport/src/UploadFileWindow.cxx @@ -22,7 +22,7 @@ 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 $ ------------------------------------------------------------------------------*/ @@ -155,7 +155,7 @@ UploadFileWindow :: onUploadButtonClicked(void) throw () // clean the entry fields nameEntry->set_text(""); fileNameEntry->set_text(""); - } catch (StorageException &e) { + } catch (XmlRpcException &e) { statusBar->set_text(e.what()); } } diff --git a/livesupport/products/gLiveSupport/var/root.txt b/livesupport/products/gLiveSupport/var/root.txt index c8396422d..cea1ce7f3 100644 --- a/livesupport/products/gLiveSupport/var/root.txt +++ b/livesupport/products/gLiveSupport/var/root.txt @@ -35,8 +35,10 @@ root:table titleColumnLabel:string { "title" } closeButtonLabel:string { "close" } - removeMenuItem:string { "_Remove" } - addToPlaylistMenuItem:string { "_Add To Playlist" } + removeMenuItem:string { "_Remove" } + addToPlaylistMenuItem:string { "_Add To Playlist" } + schedulePlaylistMenuItem:string { "_Schedule Playlist" } + deleteMenuItem:string { "_Delete" } } playlistListWindow:table @@ -64,5 +66,27 @@ root:table 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" } + } + }