diff --git a/campcaster/src/products/gLiveSupport/src/GLiveSupport.cxx b/campcaster/src/products/gLiveSupport/src/GLiveSupport.cxx index 4f6f473e4..5f2b59c8b 100644 --- a/campcaster/src/products/gLiveSupport/src/GLiveSupport.cxx +++ b/campcaster/src/products/gLiveSupport/src/GLiveSupport.cxx @@ -1118,7 +1118,9 @@ GLiveSupport :: savePlaylist(void) } // update with new version // this will also add it to the local cache + uncachePlaylist(editedPlaylist->getId()); addToScratchpad(editedPlaylist); + refreshPlaylistInLiveMode(editedPlaylist); } editedPlaylist.reset(); } @@ -1688,3 +1690,15 @@ GLiveSupport :: displayAuthenticationServerMissingMessage(void) throw () } } + +/*------------------------------------------------------------------------------ + * Refresh the playlist in the Live Mode window. + *----------------------------------------------------------------------------*/ +void +LiveSupport :: GLiveSupport :: +GLiveSupport :: refreshPlaylistInLiveMode(Ptr::Ref playlist) + throw () +{ + masterPanel->refreshPlaylistInLiveMode(playlist); +} + diff --git a/campcaster/src/products/gLiveSupport/src/GLiveSupport.h b/campcaster/src/products/gLiveSupport/src/GLiveSupport.h index 3d7ca03b3..cf20d0819 100644 --- a/campcaster/src/products/gLiveSupport/src/GLiveSupport.h +++ b/campcaster/src/products/gLiveSupport/src/GLiveSupport.h @@ -344,6 +344,19 @@ class GLiveSupport : public LocalizedConfigurable, void displayAuthenticationServerMissingMessage(void) throw (); + /** + * Refresh the playlist in the Live Mode window. + * Updates the playlist to the new copy supplied in the argument, + * if it is present in the Live Mode window. + * This is called by savePlaylist() after the playlist has been + * edited. + * + * @param playlist the new version of the playlist. + */ + void + refreshPlaylistInLiveMode(Ptr::Ref playlist) + throw (); + protected: /** diff --git a/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx b/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx index 0a08f5f97..3c609d4d6 100644 --- a/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx @@ -208,13 +208,24 @@ LiveModeWindow :: LiveModeWindow (Ptr::Ref gLiveSupport, /*------------------------------------------------------------------------------ - * Add a new item to the Live Mode Window. + * Add a new item to the top of the Live Mode Window. *----------------------------------------------------------------------------*/ void LiveModeWindow :: addItem(Ptr::Ref playable) throw () { - Gtk::TreeModel::Row row = *(treeModel->append()); + addItem(treeModel->append(), playable); +} + + +/*------------------------------------------------------------------------------ + * Add a new item as the given row in the Live Mode Window. + *----------------------------------------------------------------------------*/ +void +LiveModeWindow :: addItem(Gtk::TreeModel::iterator iter, + Ptr::Ref playable) throw () +{ + Gtk::TreeModel::Row row = *iter; row[modelColumns.playableColumn] = playable; Ptr::Ref infoString(new Glib::ustring); @@ -444,3 +455,19 @@ LiveModeWindow :: on_hide(void) throw () GuiWindow::on_hide(); } + +/*------------------------------------------------------------------------------ + * Refresh the playlist in the window. + *----------------------------------------------------------------------------*/ +void +LiveModeWindow :: refreshPlaylist(Ptr::Ref playlist) throw () +{ + for (Gtk::TreeModel::iterator iter = treeModel->children().begin(); + iter != treeModel->children().end(); ++iter) { + Ptr::Ref currentItem = (*iter)[modelColumns.playableColumn]; + if (*currentItem->getId() == *playlist->getId()) { + addItem(iter, playlist); + } + } +} + diff --git a/campcaster/src/products/gLiveSupport/src/LiveModeWindow.h b/campcaster/src/products/gLiveSupport/src/LiveModeWindow.h index f90fc595b..cfee278e3 100644 --- a/campcaster/src/products/gLiveSupport/src/LiveModeWindow.h +++ b/campcaster/src/products/gLiveSupport/src/LiveModeWindow.h @@ -246,13 +246,28 @@ class LiveModeWindow : public GuiWindow } /** - * Add a new item to the Live Mode Window. + * Add a new item to the top of the Live Mode Window. + * + * @param playable the playable object to be added. */ void addItem(Ptr::Ref playable) throw (); + /** + * Add a new item as the given row in the Live Mode Window. + * + * @param iter an iterator pointing to the row to be updated. + * @param playable the playable object to be added. + */ + void + addItem(Gtk::TreeModel::iterator iter, + Ptr::Ref playable) throw (); + /** * "Pop" the first item from the top of the Live Mode Window. + * + * @return the playable object at the top of the window, + * or 0 if the window is empty. */ Ptr::Ref popTop(void) throw (); @@ -265,6 +280,18 @@ class LiveModeWindow : public GuiWindow { cueAudioButtons->onStop(); } + + /** + * Refresh the playlist in the window. + * Updates the playlist to the new copy supplied in the argument, + * if it is present in the window. + * This is called by GLiveSupport::savePlaylist() after the playlist + * has been edited. + * + * @param playlist the new version of the playlist. + */ + void + refreshPlaylist(Ptr::Ref playlist) throw (); }; /* ================================================= external data structures */ diff --git a/campcaster/src/products/gLiveSupport/src/MasterPanelWindow.h b/campcaster/src/products/gLiveSupport/src/MasterPanelWindow.h index 293345e27..243637abb 100644 --- a/campcaster/src/products/gLiveSupport/src/MasterPanelWindow.h +++ b/campcaster/src/products/gLiveSupport/src/MasterPanelWindow.h @@ -471,6 +471,24 @@ class MasterPanelWindow : public Gtk::Window, public LocalizedObject = Ptr::Ref()) throw (); + /** + * Refresh the playlist in the Live Mode window. + * Updates the playlist to the new copy supplied in the argument, + * if it is present in the Live Mode window. + * This is called by GLiveSupport::savePlaylist() after the playlist + * has been edited. + * + * @param playlist the new version of the playlist. + */ + void + refreshPlaylistInLiveMode(Ptr::Ref playlist) + throw () + { + if (liveModeWindow) { + liveModeWindow->refreshPlaylist(playlist); + } + } + /** * Create the Scratchpad window. */