From 959c465bb01b052fe73833484ea91da516e61795 Mon Sep 17 00:00:00 2001 From: fgerlits Date: Mon, 6 Nov 2006 16:28:35 +0000 Subject: [PATCH] fixed #1918 --- .../gLiveSupport/src/LiveModeWindow.cxx | 1 - .../gLiveSupport/src/SearchWindow.cxx | 131 ++++++++++++++++-- .../products/gLiveSupport/src/SearchWindow.h | 27 ++++ .../src/products/gLiveSupport/var/root.txt | 5 +- 4 files changed, 147 insertions(+), 17 deletions(-) diff --git a/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx b/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx index ab0148ae9..043b45c93 100644 --- a/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx @@ -39,7 +39,6 @@ #include "LiveSupport/Core/TimeConversion.h" #include "LiveSupport/Widgets/WidgetFactory.h" -#include "SchedulePlaylistWindow.h" #include "LiveModeWindow.h" diff --git a/campcaster/src/products/gLiveSupport/src/SearchWindow.cxx b/campcaster/src/products/gLiveSupport/src/SearchWindow.cxx index eb2731771..86f7678b8 100644 --- a/campcaster/src/products/gLiveSupport/src/SearchWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/SearchWindow.cxx @@ -790,9 +790,10 @@ SearchWindow :: onEntryClicked (GdkEventButton * event) throw () void SearchWindow :: onAddToScratchpad(void) throw () { - Glib::RefPtr refSelection = - searchResultsTreeView->get_selection(); - Gtk::TreeModel::iterator iter = refSelection->get_selected(); + Glib::RefPtr + refSelection = searchResultsTreeView->get_selection(); + Gtk::TreeModel::iterator + iter = refSelection->get_selected(); if (iter) { Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; @@ -810,15 +811,42 @@ SearchWindow :: onAddToScratchpad(void) throw () } +/*------------------------------------------------------------------------------ + * Signal handler for the Add To Playlist menu item selected from the + * entry conext menu + *----------------------------------------------------------------------------*/ +void +SearchWindow :: onAddToPlaylist(void) throw () +{ + Glib::RefPtr + refSelection = searchResultsTreeView->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) { + Ptr::Ref errorMessage(new Glib::ustring( + "error in SearchWindow::onAddToPlaylist(): ")); + errorMessage->append(e.what()); + gLiveSupport->displayMessageWindow(errorMessage); + } + } +} + + /*------------------------------------------------------------------------------ * Add a playable to the live mode. *----------------------------------------------------------------------------*/ void SearchWindow :: onAddToLiveMode(void) throw () { - Glib::RefPtr refSelection = - searchResultsTreeView->get_selection(); - Gtk::TreeModel::iterator iter = refSelection->get_selected(); + Glib::RefPtr + refSelection = searchResultsTreeView->get_selection(); + Gtk::TreeModel::iterator + iter = refSelection->get_selected(); if (iter) { Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; @@ -838,6 +866,60 @@ SearchWindow :: onAddToLiveMode(void) throw () } +/*------------------------------------------------------------------------------ + * Event handler for the Edit Playlist menu item selected from the + * entry conext menu. + *----------------------------------------------------------------------------*/ +void +SearchWindow :: onEditPlaylist(void) throw () +{ + Glib::RefPtr + refSelection = searchResultsTreeView->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 +SearchWindow :: onSchedulePlaylist(void) throw () +{ + Glib::RefPtr + refSelection = searchResultsTreeView->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. *----------------------------------------------------------------------------*/ @@ -845,9 +927,9 @@ void SearchWindow :: onExportPlaylist(void) throw () { Glib::RefPtr - refSelection = searchResultsTreeView->get_selection(); + refSelection = searchResultsTreeView->get_selection(); Gtk::TreeModel::iterator - iter = refSelection->get_selected(); + iter = refSelection->get_selected(); if (iter) { Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; @@ -878,12 +960,12 @@ void SearchWindow :: onUploadToHub(void) throw () { Glib::RefPtr - refSelection = searchResultsTreeView->get_selection(); + refSelection = searchResultsTreeView->get_selection(); Gtk::TreeModel::iterator - iter = refSelection->get_selected(); + iter = refSelection->get_selected(); if (iter) { - Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; + Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; if (playable) { uploadToHub(playable); } @@ -919,12 +1001,12 @@ void SearchWindow :: onDownloadFromHub(void) throw () { Glib::RefPtr - refSelection = searchResultsTreeView->get_selection(); + refSelection = searchResultsTreeView->get_selection(); Gtk::TreeModel::iterator - iter = refSelection->get_selected(); + iter = refSelection->get_selected(); if (iter) { - Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; + Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; if (playable) { if (!gLiveSupport->existsPlayable(playable->getId())) { try { @@ -969,7 +1051,10 @@ SearchWindow :: on_hide(void) throw () if (exportPlaylistWindow) { exportPlaylistWindow->hide(); } - + if (schedulePlaylistWindow) { + schedulePlaylistWindow->hide(); + } + GuiWindow::on_hide(); } @@ -1032,6 +1117,10 @@ SearchWindow :: constructAudioClipContextMenu(void) throw () *getResourceUstring("addToLiveModeMenuItem"), sigc::mem_fun(*this, &SearchWindow::onAddToLiveMode))); + contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem( + *getResourceUstring("addToPlaylistMenuItem"), + sigc::mem_fun(*this, + &SearchWindow::onAddToPlaylist))); contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem( *getResourceUstring("addToScratchpadMenuItem"), sigc::mem_fun(*this, @@ -1065,11 +1154,23 @@ SearchWindow :: constructPlaylistContextMenu(void) throw () *getResourceUstring("addToLiveModeMenuItem"), sigc::mem_fun(*this, &SearchWindow::onAddToLiveMode))); + contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem( + *getResourceUstring("addToPlaylistMenuItem"), + sigc::mem_fun(*this, + &SearchWindow::onAddToPlaylist))); contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem( *getResourceUstring("addToScratchpadMenuItem"), sigc::mem_fun(*this, &SearchWindow::onAddToScratchpad))); contextMenuList.push_back(Gtk::Menu_Helpers::SeparatorElem()); + contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem( + *getResourceUstring("editPlaylistMenuItem"), + sigc::mem_fun(*this, + &SearchWindow::onEditPlaylist))); + contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem( + *getResourceUstring("schedulePlaylistMenuItem"), + sigc::mem_fun(*this, + &SearchWindow::onSchedulePlaylist))); contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem( *getResourceUstring("exportPlaylistMenuItem"), sigc::mem_fun(*this, diff --git a/campcaster/src/products/gLiveSupport/src/SearchWindow.h b/campcaster/src/products/gLiveSupport/src/SearchWindow.h index 67f3bebec..66156284b 100644 --- a/campcaster/src/products/gLiveSupport/src/SearchWindow.h +++ b/campcaster/src/products/gLiveSupport/src/SearchWindow.h @@ -55,6 +55,7 @@ #include "AdvancedSearchEntry.h" #include "BrowseEntry.h" #include "GLiveSupport.h" +#include "SchedulePlaylistWindow.h" #include "ExportPlaylistWindow.h" #include "TransportList.h" @@ -138,6 +139,11 @@ class SearchWindow : public GuiWindow */ Button * forwardButton; + /** + * The Schedule Playlist pop-up window. + */ + Ptr::Ref schedulePlaylistWindow; + /** * The Export Playlist pop-up window. */ @@ -383,12 +389,33 @@ class SearchWindow : public GuiWindow void onAddToScratchpad(void) throw (); + /** + * Signal handler for the "add to playlist" menu item selected from + * the entry context menu. + */ + virtual void + onAddToPlaylist(void) throw (); + /** * Add a playable to the live mode. */ void onAddToLiveMode(void) 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. diff --git a/campcaster/src/products/gLiveSupport/var/root.txt b/campcaster/src/products/gLiveSupport/var/root.txt index 1752557f2..7c7b02e05 100644 --- a/campcaster/src/products/gLiveSupport/var/root.txt +++ b/campcaster/src/products/gLiveSupport/var/root.txt @@ -208,8 +208,11 @@ root:table allStringForBrowse { "--- all ---" } - addToScratchpadMenuItem:string { "_Add To Scratchpad" } + addToScratchpadMenuItem:string { "Add To S_cratchpad" } + addToPlaylistMenuItem:string { "_Add to Playlist" } addToLiveModeMenuItem:string { "Add To _Live Mode" } + editPlaylistMenuItem:string { "_Edit Playlist" } + schedulePlaylistMenuItem:string { "_Schedule Playlist" } exportPlaylistMenuItem:string { "E_xport Playlist" } uploadToHubMenuItem:string { "Upload to the network hub" } downloadFromHubMenuItem:string { "Download from the network hub" }