scheduling now works, so-so
This commit is contained in:
parent
2ba3b1d751
commit
5a31ad37ed
8 changed files with 120 additions and 36 deletions
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.3 $
|
||||
Version : $Revision: 1.4 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/DjBagWindow.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -385,7 +385,6 @@ DjBagWindow :: onSchedulePlaylist(void) throw ()
|
|||
Ptr<StorageClientInterface>::Ref storage =
|
||||
gLiveSupport->getStorage();
|
||||
|
||||
// append the appropriate playable object to the end of the playlist
|
||||
if (!storage->existsPlaylist(sessionId, uid)) {
|
||||
return;
|
||||
}
|
||||
|
@ -401,7 +400,6 @@ DjBagWindow :: onSchedulePlaylist(void) throw ()
|
|||
}
|
||||
|
||||
Ptr<SchedulePlaylistWindow>::Ref scheduleWindow;
|
||||
|
||||
scheduleWindow.reset(new SchedulePlaylistWindow(gLiveSupport,
|
||||
bundle,
|
||||
playlist));
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.12 $
|
||||
Version : $Revision: 1.13 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -329,14 +329,53 @@ GLiveSupport :: uploadFile(Ptr<const Glib::ustring>::Ref title,
|
|||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Upload a file to the server.
|
||||
* Open a playlist for editing.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Ptr<Playlist>::Ref
|
||||
LiveSupport :: GLiveSupport ::
|
||||
GLiveSupport :: openPlaylistForEditing(Ptr<UniqueId>::Ref playlistId)
|
||||
throw (XmlRpcException)
|
||||
{
|
||||
releaseEditedPlaylist();
|
||||
|
||||
if (!playlistId.get()) {
|
||||
editedPlaylist = storage->createPlaylist(sessionId);
|
||||
playlistId = editedPlaylist->getId();
|
||||
}
|
||||
|
||||
editedPlaylist = storage->editPlaylist(sessionId, playlistId);
|
||||
|
||||
return editedPlaylist;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Release the edited playlist.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
LiveSupport :: GLiveSupport ::
|
||||
GLiveSupport :: addToPlaylist(Ptr<const UniqueId>::Ref id) throw ()
|
||||
GLiveSupport :: releaseEditedPlaylist(void)
|
||||
throw (XmlRpcException)
|
||||
{
|
||||
if (editedPlaylist.get()) {
|
||||
if (editedPlaylist->isLocked()) {
|
||||
storage->releasePlaylist(sessionId, editedPlaylist);
|
||||
}
|
||||
editedPlaylist.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Add a playlist to the currently edited playlist
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
LiveSupport :: GLiveSupport ::
|
||||
GLiveSupport :: addToPlaylist(Ptr<const UniqueId>::Ref id)
|
||||
throw (XmlRpcException)
|
||||
{
|
||||
if (!editedPlaylist.get()) {
|
||||
editedPlaylist = storage->createPlaylist(sessionId);
|
||||
openPlaylistForEditing();
|
||||
}
|
||||
|
||||
// for some wierd reason, the storage functions won't accept
|
||||
|
@ -361,14 +400,16 @@ GLiveSupport :: addToPlaylist(Ptr<const UniqueId>::Ref id) throw ()
|
|||
*----------------------------------------------------------------------------*/
|
||||
Ptr<Playlist>::Ref
|
||||
LiveSupport :: GLiveSupport ::
|
||||
GLiveSupport :: uploadPlaylist(Ptr<const Glib::ustring>::Ref title)
|
||||
GLiveSupport :: savePlaylist(void)
|
||||
throw (XmlRpcException)
|
||||
{
|
||||
editedPlaylist->setTitle(title);
|
||||
|
||||
storage->savePlaylist(sessionId, editedPlaylist);
|
||||
|
||||
Ptr<Playlist>::Ref playlist = storage->getPlaylist(sessionId,
|
||||
editedPlaylist->getId());
|
||||
|
||||
// add the saved playlist to the DJ Bag, and update it
|
||||
// TODO: if already in the DJ bag, don't add, just pop it to the front
|
||||
djBagContents->push_front(editedPlaylist);
|
||||
masterPanel->updateDjBagWindow();
|
||||
|
||||
|
@ -385,11 +426,8 @@ GLiveSupport :: schedulePlaylist(Ptr<Playlist>::Ref playlist,
|
|||
Ptr<posix_time::ptime>::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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.14 $
|
||||
Version : $Revision: 1.15 $
|
||||
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.14 $
|
||||
* @version $Revision: 1.15 $
|
||||
* @see LocalizedObject#getBundle(const xmlpp::Element &)
|
||||
* @see AuthenticationClientFactory
|
||||
* @see StorageClientFactory
|
||||
|
@ -369,29 +369,61 @@ class GLiveSupport : public LocalizedConfigurable,
|
|||
return editedPlaylist;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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()
|
||||
*
|
||||
* @param playlistId the id of the playlist to open for editing.
|
||||
* if a reference to 0, create a new playlist.
|
||||
* @return the new playlist object, which is opened for editing.
|
||||
* @exception XmlRpcException on XMl-RPC errors.
|
||||
* @see #getEditedPlaylist
|
||||
* @see #releaseEditedPlaylist
|
||||
*/
|
||||
Ptr<Playlist>::Ref
|
||||
openPlaylistForEditing(
|
||||
Ptr<UniqueId>::Ref playlistId = Ptr<UniqueId>::Ref())
|
||||
throw (XmlRpcException);
|
||||
|
||||
/**
|
||||
* Add a playable item to the currently open playlist.
|
||||
* If there is no currently open playlist, open the simple playlist
|
||||
* management window with a new playlist, holding only this one
|
||||
* entry.
|
||||
* Always release the opened playlist by calling
|
||||
* releaseEditedPlaylist()
|
||||
*
|
||||
* @param id the id of the playable object to add to the playlist.
|
||||
* @exception XmlRpcException on XMl-RPC errors.
|
||||
* @see #releaseEditedPlaylist
|
||||
*/
|
||||
void
|
||||
addToPlaylist(Ptr<const UniqueId>::Ref id) throw ();
|
||||
|
||||
addToPlaylist(Ptr<const UniqueId>::Ref id)
|
||||
throw (XmlRpcException);
|
||||
/**
|
||||
* Save the currently edited playlist in storage.
|
||||
* This call has to be preceeded by a call to openPlaylistForEditing()
|
||||
* or addToPlaylist().
|
||||
*
|
||||
* @param title the title of the audio clip.
|
||||
* @return the audio clip that was uploaded.
|
||||
* @return the audio clip that was saved.
|
||||
* @exception XmlRpcException on upload failures.
|
||||
* @see #openPlaylistForEditing
|
||||
* @see #addToPlaylist
|
||||
*/
|
||||
Ptr<Playlist>::Ref
|
||||
uploadPlaylist(Ptr<const Glib::ustring>::Ref title)
|
||||
throw (XmlRpcException);
|
||||
savePlaylist(void) throw (XmlRpcException);
|
||||
|
||||
/**
|
||||
* Release the playlist that was opened for editing.
|
||||
*
|
||||
* @exception XmlRpcException on XML-RPC errors.
|
||||
* @see #openPlaylistForEditing
|
||||
*/
|
||||
void
|
||||
releaseEditedPlaylist(void) throw (XmlRpcException);
|
||||
|
||||
|
||||
/**
|
||||
* Return the scheduled entries for a specified time interval.
|
||||
*
|
||||
|
|
|
@ -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/SchedulePlaylistWindow.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -82,7 +82,10 @@ SchedulePlaylistWindow :: SchedulePlaylistWindow (
|
|||
std::cerr << e.what() << std::endl;
|
||||
}
|
||||
|
||||
playlistLabel.reset(new Gtk::Label(*playlist->getTitle()));
|
||||
// the title is lost, for some reason, see
|
||||
// http://bugs.campware.org/view.php?id=534
|
||||
// playlistLabel.reset(new Gtk::Label(*playlist->getTitle()));
|
||||
playlistLabel.reset(new Gtk::Label("TODO: playlist title here"));
|
||||
calendar.reset(new Gtk::Calendar());
|
||||
hourEntry.reset(new Gtk::Entry());
|
||||
minuteEntry.reset(new Gtk::Entry());
|
||||
|
@ -154,11 +157,6 @@ SchedulePlaylistWindow :: onScheduleButtonClicked (void) throw ()
|
|||
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) {
|
||||
|
|
|
@ -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/SchedulerWindow.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -196,6 +196,7 @@ SchedulerWindow :: showContents(void) throw ()
|
|||
*midnight));
|
||||
|
||||
entries = gLiveSupport->displaySchedule(from, to);
|
||||
|
||||
it = entries->begin();
|
||||
end = entries->end();
|
||||
entriesModel->clear();
|
||||
|
@ -217,7 +218,10 @@ SchedulerWindow :: showContents(void) throw ()
|
|||
row[entryColumns->idColumn] = entry->getId();
|
||||
row[entryColumns->startColumn] =
|
||||
to_simple_string(*entry->getStartTime());
|
||||
row[entryColumns->titleColumn] = *playlist->getTitle();
|
||||
// the title is lost, for some reason, see
|
||||
// http://bugs.campware.org/view.php?id=534
|
||||
// row[entryColumns->titleColumn] = *playlist->getTitle();
|
||||
row[entryColumns->titleColumn] = "TODO: playlist title here";
|
||||
row[entryColumns->endColumn] = to_simple_string(*entry->getEndTime());
|
||||
|
||||
++it;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.3 $
|
||||
Version : $Revision: 1.4 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -145,11 +145,21 @@ SimplePlaylistManagementWindow :: onSaveButtonClicked (void) throw ()
|
|||
|
||||
title.reset(new Glib::ustring(nameEntry->get_text()));
|
||||
|
||||
playlist = gLiveSupport->uploadPlaylist(title);
|
||||
playlist = gLiveSupport->getEditedPlaylist();
|
||||
playlist->setTitle(title);
|
||||
|
||||
Glib::ustring statusText("uploaded playlist ");
|
||||
statusText += *playlist->getTitle();
|
||||
statusBar->set_text(statusText);
|
||||
playlist = gLiveSupport->savePlaylist();
|
||||
|
||||
Ptr<UnicodeString>::Ref uTitle = ustringToUnicodeString(
|
||||
playlist->getTitle());
|
||||
Formattable arguments[] = { *uTitle };
|
||||
Ptr<Glib::ustring>::Ref statusText = formatMessageUstring(
|
||||
"playlistSavedMessage",
|
||||
arguments,
|
||||
1);
|
||||
statusBar->set_text(*statusText);
|
||||
|
||||
gLiveSupport->releaseEditedPlaylist();
|
||||
} catch (XmlRpcException &e) {
|
||||
statusBar->set_text(e.what());
|
||||
}
|
||||
|
@ -162,6 +172,8 @@ SimplePlaylistManagementWindow :: onSaveButtonClicked (void) throw ()
|
|||
void
|
||||
SimplePlaylistManagementWindow :: onCloseButtonClicked (void) throw ()
|
||||
{
|
||||
gLiveSupport->releaseEditedPlaylist();
|
||||
|
||||
hide();
|
||||
}
|
||||
|
||||
|
|
|
@ -84,6 +84,7 @@ hu:table
|
|||
saveButtonLabel:string { "elment" }
|
||||
closeButtonLabel:string { "bezár" }
|
||||
statusBar:string { "állapotsor" }
|
||||
playlistSavedMessage:string { "playlist {0} elmentve" }
|
||||
}
|
||||
|
||||
schedulerWindow:table
|
||||
|
|
|
@ -84,6 +84,7 @@ root:table
|
|||
saveButtonLabel:string { "save" }
|
||||
closeButtonLabel:string { "close" }
|
||||
statusBar:string { "status bar" }
|
||||
playlistSavedMessage:string { "saved playlist {0}" }
|
||||
}
|
||||
|
||||
schedulerWindow:table
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue