This commit is contained in:
fgerlits 2006-08-01 16:04:59 +00:00
parent aa30066bdb
commit 1c1455085c
4 changed files with 46 additions and 11 deletions

View file

@ -951,12 +951,14 @@ GLiveSupport :: setNowPlaying(Ptr<Playable>::Ref playable)
/*------------------------------------------------------------------------------
* Open a playlist for editing.
*----------------------------------------------------------------------------*/
Ptr<Playlist>::Ref
void
LiveSupport :: GLiveSupport ::
GLiveSupport :: openPlaylistForEditing(Ptr<const UniqueId>::Ref playlistId)
throw (XmlRpcException)
{
cancelEditedPlaylist();
if (masterPanel->cancelEditedPlaylist() == false) {
return; // the user canceled the operation
}
if (!playlistId.get()) {
playlistId = storage->createPlaylist(sessionId);
@ -983,8 +985,6 @@ GLiveSupport :: openPlaylistForEditing(Ptr<const UniqueId>::Ref playlistId)
editedPlaylist->createSavedCopy();
masterPanel->updateSimplePlaylistMgmtWindow();
return editedPlaylist;
}

View file

@ -724,7 +724,16 @@ class GLiveSupport : public LocalizedConfigurable,
* Create a new playlist or Open a playlist for editing.
* The opened playlist can be later accessed by getEditedPlaylist().
* Always release the opened playlist by calling
* releaseEditedPlaylist()
* releaseEditedPlaylist().
*
* If the argument is 0, a new playlist is created in the storage.
*
* After a call to this function, getEditedPlaylist() is guaranteed
* to return a non-0 value.
*
* If there is a playlist being edited, the
* SimplePlaylistManagementWindow's confirmation message is displayed.
* If the user presses "Cancel", then this function does nothing.
*
* @param playlistId the id of the playlist to open for editing.
* if a reference to 0, create a new playlist.
@ -733,7 +742,7 @@ class GLiveSupport : public LocalizedConfigurable,
* @see #getEditedPlaylist
* @see #releaseEditedPlaylist
*/
Ptr<Playlist>::Ref
void
openPlaylistForEditing(
Ptr<const UniqueId>::Ref playlistId
= Ptr<const UniqueId>::Ref())

View file

@ -216,7 +216,7 @@ SimplePlaylistManagementWindow :: SimplePlaylistManagementWindow (
saveButton->signal_clicked().connect(sigc::mem_fun(*this,
&SimplePlaylistManagementWindow::onSaveButtonClicked));
closeButton->signal_clicked().connect(sigc::mem_fun(*this,
&SimplePlaylistManagementWindow::onCloseButtonClicked));
&SimplePlaylistManagementWindow::onBottomCloseButtonClicked));
// show
set_name(windowName);
@ -325,6 +325,7 @@ SimplePlaylistManagementWindow :: cancelPlaylist(void) throw ()
std::cerr << e.what() << std::endl;
return false;
}
isPlaylistModified = false;
break;
case DialogWindow::yesButton:
@ -361,6 +362,18 @@ SimplePlaylistManagementWindow :: closeWindow(void) throw ()
}
/*------------------------------------------------------------------------------
* Signal handler for the save button getting clicked.
*----------------------------------------------------------------------------*/
void
SimplePlaylistManagementWindow :: onBottomCloseButtonClicked(void) throw ()
{
if (cancelPlaylist()) {
closeWindow();
}
}
/*------------------------------------------------------------------------------
* Signal handler for the "lock fades" check button toggled.
*----------------------------------------------------------------------------*/
@ -432,7 +445,9 @@ SimplePlaylistManagementWindow :: onTitleEdited(void) throw()
Ptr<Playlist>::Ref playlist = gLiveSupport->getEditedPlaylist();
if (!playlist) {
try {
playlist = gLiveSupport->openPlaylistForEditing();
gLiveSupport->openPlaylistForEditing();
playlist = gLiveSupport->getEditedPlaylist();
} catch (XmlRpcException &e) {
std::cerr << "error in SimplePlaylistManagementWindow::"
"onTitleEdited(): "

View file

@ -183,11 +183,22 @@ class SimplePlaylistManagementWindow : public GuiWindow
selectRow(int rowNumber) throw ();
/**
* Signal handler for the save button clicked.
* Signal handler for a click on the save button.
*/
void
onSaveButtonClicked(void) throw ();
/**
* Signal handler for a click on the close button at the bottom
* right corner.
* This cancels the edited playlist; the normal close button (X)
* at the upper right corner hides the window only.
* If the playlist has been modified, a confirmation message will
* be displayed.
*/
void
onBottomCloseButtonClicked(void) throw ();
/**
* Signal handler for the "lock fades" check button toggled.
*/