diff --git a/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx b/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx index 1ee627894..ab0148ae9 100644 --- a/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx @@ -376,6 +376,58 @@ LiveModeWindow :: onKeyPressed(GdkEventKey * event) throw () } +/*------------------------------------------------------------------------------ + * Event handler for the Edit Playlist menu item selected from the + * entry conext menu. + *----------------------------------------------------------------------------*/ +void +LiveModeWindow :: onEditPlaylist(void) throw () +{ + Glib::RefPtr + refSelection = treeView->get_selection(); + Gtk::TreeModel::iterator iter = refSelection->get_selected(); + + if (iter) { + Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; + Ptr::Ref playlist = playable->getPlaylist(); + if (playlist) { + try { + gLiveSupport->openPlaylistForEditing(playlist->getId()); + } catch (XmlRpcException &e) { + gLiveSupport->displayMessageWindow(getResourceUstring( + "cannotEditPlaylistMsg" )); + } + } + } +} + + +/*------------------------------------------------------------------------------ + * Event handler for the Schedule Playlist menu item selected from the + * entry conext menu. + *----------------------------------------------------------------------------*/ +void +LiveModeWindow :: onSchedulePlaylist(void) throw () +{ + Glib::RefPtr + refSelection = treeView->get_selection(); + Gtk::TreeModel::iterator iter = refSelection->get_selected(); + + if (iter) { + Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; + Ptr::Ref playlist = playable->getPlaylist(); + if (playlist) { + schedulePlaylistWindow.reset(new SchedulePlaylistWindow( + gLiveSupport, + gLiveSupport->getBundle("schedulePlaylistWindow"), + playlist)); + schedulePlaylistWindow->set_transient_for(*this); + Gtk::Main::run(*schedulePlaylistWindow); + } + } +} + + /*------------------------------------------------------------------------------ * Signal handler for "export playlist" in the context menu. *----------------------------------------------------------------------------*/ @@ -401,6 +453,30 @@ LiveModeWindow :: onExportPlaylist(void) throw () } +/*------------------------------------------------------------------------------ + * Event handler for the Add To Playlist menu item selected from the + * entry conext menu + *----------------------------------------------------------------------------*/ +void +LiveModeWindow :: onAddToPlaylist(void) throw () +{ + Glib::RefPtr + refSelection = treeView->get_selection(); + Gtk::TreeModel::iterator iter = refSelection->get_selected(); + + if (iter) { + Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; + try { + gLiveSupport->addToPlaylist(playable->getId()); + } catch (XmlRpcException &e) { + std::cerr << "error in LiveModeWindow::onAddToPlaylist(): " + << e.what() << std::endl; + return; + } + } +} + + /*------------------------------------------------------------------------------ * Signal handler for "upload to hub" in the context menu. *----------------------------------------------------------------------------*/ @@ -418,20 +494,6 @@ LiveModeWindow :: onUploadToHub(void) throw () } -/*------------------------------------------------------------------------------ - * Event handler called when the the window gets hidden. - *----------------------------------------------------------------------------*/ -void -LiveModeWindow :: on_hide(void) throw () -{ - if (exportPlaylistWindow) { - exportPlaylistWindow->hide(); - } - - GuiWindow::on_hide(); -} - - /*------------------------------------------------------------------------------ * Refresh the playlist in the window. *----------------------------------------------------------------------------*/ @@ -466,6 +528,10 @@ LiveModeWindow :: constructAudioClipContextMenu(void) throw () *getResourceUstring("cueMenuItem"), sigc::mem_fun(*cueAudioButtons, &CuePlayer::onPlayItem))); + contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem( + *getResourceUstring("addToPlaylistMenuItem"), + sigc::mem_fun(*this, + &LiveModeWindow::onAddToPlaylist))); contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem( *getResourceUstring("removeMenuItem"), sigc::mem_fun(*treeView, @@ -503,11 +569,23 @@ LiveModeWindow :: constructPlaylistContextMenu(void) throw () *getResourceUstring("cueMenuItem"), sigc::mem_fun(*cueAudioButtons, &CuePlayer::onPlayItem))); + contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem( + *getResourceUstring("addToPlaylistMenuItem"), + sigc::mem_fun(*this, + &LiveModeWindow::onAddToPlaylist))); contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem( *getResourceUstring("removeMenuItem"), sigc::mem_fun(*treeView, &ZebraTreeView::onRemoveMenuOption))); contextMenuList.push_back(Gtk::Menu_Helpers::SeparatorElem()); + contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem( + *getResourceUstring("editPlaylistMenuItem"), + sigc::mem_fun(*this, + &LiveModeWindow::onEditPlaylist))); + contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem( + *getResourceUstring("schedulePlaylistMenuItem"), + sigc::mem_fun(*this, + &LiveModeWindow::onSchedulePlaylist))); contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem( *getResourceUstring("exportPlaylistMenuItem"), sigc::mem_fun(*this, @@ -526,3 +604,20 @@ LiveModeWindow :: constructPlaylistContextMenu(void) throw () return contextMenu; } + +/*------------------------------------------------------------------------------ + * Event handler called when the the window gets hidden. + *----------------------------------------------------------------------------*/ +void +LiveModeWindow :: on_hide(void) throw () +{ + if (exportPlaylistWindow) { + exportPlaylistWindow->hide(); + } + if (schedulePlaylistWindow) { + schedulePlaylistWindow->hide(); + } + + GuiWindow::on_hide(); +} + diff --git a/campcaster/src/products/gLiveSupport/src/LiveModeWindow.h b/campcaster/src/products/gLiveSupport/src/LiveModeWindow.h index df05e4e67..57dbb4f25 100644 --- a/campcaster/src/products/gLiveSupport/src/LiveModeWindow.h +++ b/campcaster/src/products/gLiveSupport/src/LiveModeWindow.h @@ -55,6 +55,7 @@ #include "CuePlayer.h" #include "GLiveSupport.h" #include "ExportPlaylistWindow.h" +#include "SchedulePlaylistWindow.h" namespace LiveSupport { namespace GLiveSupport { @@ -85,6 +86,11 @@ class LiveModeWindow : public GuiWindow */ Ptr::Ref exportPlaylistWindow; + /** + * The Schedule Playlist pop-up window. + */ + Ptr::Ref schedulePlaylistWindow; + /** * The cue player widget with play/pause and stop buttons. */ @@ -217,6 +223,20 @@ class LiveModeWindow : public GuiWindow bool onKeyPressed(GdkEventKey * event) throw (); + /** + * Signal handler for the "edit playlist" menu item selected from + * the entry context menu. + */ + virtual void + onEditPlaylist(void) throw (); + + /** + * Signal handler for the "schedule playlist" menu item selected + * from the entry context menu. + */ + virtual void + onSchedulePlaylist(void) throw (); + /** * Signal handler for the "export playlist" menu item selected from * the entry context menu. @@ -224,6 +244,13 @@ class LiveModeWindow : public GuiWindow virtual void onExportPlaylist(void) throw (); + /** + * Signal handler for the "add to playlist" menu item selected from + * the entry context menu. + */ + virtual void + onAddToPlaylist(void) throw (); + /** * Signal handler for the "upload to hub" menu item selected from * the entry context menu. diff --git a/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.cxx b/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.cxx index a4bb61832..24f9f33f8 100644 --- a/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.cxx @@ -64,12 +64,10 @@ using namespace LiveSupport::GLiveSupport; SchedulePlaylistWindow :: SchedulePlaylistWindow ( Ptr::Ref gLiveSupport, Ptr::Ref bundle, - Button * windowOpenerButton, Ptr::Ref playlist) throw () : GuiWindow(gLiveSupport, - bundle, - windowOpenerButton), + bundle), playlist(playlist) { Ptr::Ref wf = WidgetFactory::getInstance(); diff --git a/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.h b/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.h index fb2defaa9..faf9c8520 100644 --- a/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.h +++ b/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.h @@ -159,13 +159,10 @@ class SchedulePlaylistWindow : public GuiWindow * all the vital info. * @param bundle the resource bundle holding the localized * resources for this window. - * @param windowOpenerButton the button which was pressed to open - * this window. * @param playlist the playlist to schedule. */ SchedulePlaylistWindow(Ptr::Ref gLiveSupport, Ptr::Ref bundle, - Button * windowOpenerButton, Ptr::Ref playlist) throw (); diff --git a/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.cxx b/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.cxx index 250509ec9..2466bab7a 100644 --- a/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.cxx @@ -429,24 +429,6 @@ ScratchpadWindow :: onEditPlaylist(void) throw () } -/*------------------------------------------------------------------------------ - * Event handler for the Add To Playlist menu item selected from the - * entry conext menu - *----------------------------------------------------------------------------*/ -void -ScratchpadWindow :: onAddToPlaylist(void) throw () -{ - Ptr::Ref playable = currentRow[modelColumns.playableColumn]; - try { - gLiveSupport->addToPlaylist(playable->getId()); - } catch (XmlRpcException &e) { - std::cerr << "error in ScratchpadWindow::onAddToPlaylist(): " - << e.what() << std::endl; - return; - } -} - - /*------------------------------------------------------------------------------ * Event handler for the Schedule Playlist menu item selected from the * entry conext menu @@ -480,25 +462,12 @@ ScratchpadWindow :: onSchedulePlaylist(void) throw () schedulePlaylistWindow.reset(new SchedulePlaylistWindow(gLiveSupport, bundle, - 0, /* no button */ playlist)); Gtk::Main::run(*schedulePlaylistWindow); } -/*------------------------------------------------------------------------------ - * Event handler for the Add To Live Mode menu item selected from the - * entry conext menu - *----------------------------------------------------------------------------*/ -void -ScratchpadWindow :: onAddToLiveMode(void) throw () -{ - Ptr::Ref playable = currentRow[modelColumns.playableColumn]; - gLiveSupport->addToLiveMode(playable); -} - - /*------------------------------------------------------------------------------ * Signal handler for "export playlist" in the context menu. *----------------------------------------------------------------------------*/ @@ -523,6 +492,36 @@ ScratchpadWindow :: onExportPlaylist(void) throw () } +/*------------------------------------------------------------------------------ + * Event handler for the Add To Playlist menu item selected from the + * entry conext menu + *----------------------------------------------------------------------------*/ +void +ScratchpadWindow :: onAddToPlaylist(void) throw () +{ + Ptr::Ref playable = currentRow[modelColumns.playableColumn]; + try { + gLiveSupport->addToPlaylist(playable->getId()); + } catch (XmlRpcException &e) { + std::cerr << "error in ScratchpadWindow::onAddToPlaylist(): " + << e.what() << std::endl; + return; + } +} + + +/*------------------------------------------------------------------------------ + * Event handler for the Add To Live Mode menu item selected from the + * entry conext menu + *----------------------------------------------------------------------------*/ +void +ScratchpadWindow :: onAddToLiveMode(void) throw () +{ + Ptr::Ref playable = currentRow[modelColumns.playableColumn]; + gLiveSupport->addToLiveMode(playable); +} + + /*------------------------------------------------------------------------------ * Signal handler for "upload to hub" in the context menu. *----------------------------------------------------------------------------*/ diff --git a/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.h b/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.h index d05da1644..579498343 100644 --- a/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.h +++ b/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.h @@ -293,11 +293,25 @@ class ScratchpadWindow : public GuiWindow, /** * Signal handler for the "edit playlist" menu item selected from - * the entry context menu. + * the entry context menu. For playlists only. */ virtual void onEditPlaylist(void) throw (); + /** + * Signal handler for the "schedule playlist" menu item selected + * from the entry context menu. For playlists only. + */ + virtual void + onSchedulePlaylist(void) throw (); + + /** + * Signal handler for the "export playlist" menu item selected from + * the entry context menu. For playlists only. + */ + virtual void + onExportPlaylist(void) throw (); + /** * Signal handler for the "add to playlist" menu item selected from * the entry context menu. @@ -305,13 +319,6 @@ class ScratchpadWindow : public GuiWindow, virtual void onAddToPlaylist(void) throw (); - /** - * Signal handler for the "schedule playlist" menu item selected - * from the entry context menu. - */ - virtual void - onSchedulePlaylist(void) throw (); - /** * Signal handler for the "add to live mode" menu item selected from * the entry context menu. @@ -319,13 +326,6 @@ class ScratchpadWindow : public GuiWindow, virtual void onAddToLiveMode(void) throw (); - /** - * Signal handler for the "export playlist" menu item selected from - * the entry context menu. - */ - virtual void - onExportPlaylist(void) throw (); - /** * Signal handler for the "upload to hub" menu item selected from * the entry context menu. diff --git a/campcaster/src/products/gLiveSupport/var/root.txt b/campcaster/src/products/gLiveSupport/var/root.txt index f59dfd038..1752557f2 100644 --- a/campcaster/src/products/gLiveSupport/var/root.txt +++ b/campcaster/src/products/gLiveSupport/var/root.txt @@ -72,16 +72,14 @@ root:table clearListButtonLabel:string { "Clear list" } removeButtonLabel:string { "Remove item(s)" } - upMenuItem:string { "Move _Up" } - downMenuItem:string { "Move D_own" } - removeMenuItem:string { "_Remove" } - editPlaylistMenuItem:string { "_Edit" } - addToPlaylistMenuItem:string { "_Add To Playlist" } - schedulePlaylistMenuItem:string { "_Schedule" } cueMenuItem:string { "Pre_view" } - addToLiveModeMenuItem:string { "Add To _Live Mode" } + addToLiveModeMenuItem:string { "Add to _Live Mode" } + addToPlaylistMenuItem:string { "_Add to Playlist" } + removeMenuItem:string { "_Remove" } + editPlaylistMenuItem:string { "_Edit Playlist" } + schedulePlaylistMenuItem:string { "_Schedule Playlist" } exportPlaylistMenuItem:string { "E_xport Playlist" } - uploadToHubMenuItem:string { "Upload to the network hub" } + uploadToHubMenuItem:string { "Upload to Network Hub" } cannotEditPlaylistMsg:string { "Could not open playlist for editing." } @@ -245,15 +243,19 @@ root:table { windowTitle:string { "Live Mode" } - cueMenuItem:string { "Pre_view" } - upMenuItem:string { "Move _Up" } - downMenuItem:string { "Move D_own" } - removeMenuItem:string { "_Remove" } playMenuItem:string { "_Play" } + cueMenuItem:string { "Pre_view" } + addToPlaylistMenuItem:string { "_Add to Playlist" } + removeMenuItem:string { "_Remove" } + editPlaylistMenuItem:string { "_Edit Playlist" } + schedulePlaylistMenuItem:string { "_Schedule Playlist" } exportPlaylistMenuItem:string { "E_xport Playlist" } - uploadToHubMenuItem:string { "Upload to the network hub" } + uploadToHubMenuItem:string { "Upload to Network Hub" } cuePlayerLabel:string { "Preview" } + + cannotEditPlaylistMsg:string + { "Could not open playlist for editing." } } optionsWindow:table