parent
21e94fe1ab
commit
c1b1b7abf4
12 changed files with 193 additions and 66 deletions
|
@ -807,7 +807,7 @@ GLiveSupport :: acquirePlayable(Ptr<const UniqueId>::Ref id)
|
|||
void
|
||||
LiveSupport :: GLiveSupport ::
|
||||
GLiveSupport :: uncachePlaylist(Ptr<const UniqueId>::Ref id)
|
||||
throw ()
|
||||
throw (XmlRpcException)
|
||||
{
|
||||
Ptr<Playlist>::Ref playlist;
|
||||
PlaylistMap::iterator it;
|
||||
|
@ -829,7 +829,7 @@ GLiveSupport :: uncachePlaylist(Ptr<const UniqueId>::Ref id)
|
|||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
LiveSupport :: GLiveSupport ::
|
||||
GLiveSupport :: releaseOpennedAudioClips(void) throw ()
|
||||
GLiveSupport :: releaseOpennedAudioClips(void) throw (XmlRpcException)
|
||||
{
|
||||
AudioClipMap::iterator it = opennedAudioClips->begin();
|
||||
AudioClipMap::iterator end = opennedAudioClips->end();
|
||||
|
@ -853,7 +853,7 @@ GLiveSupport :: releaseOpennedAudioClips(void) throw ()
|
|||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
LiveSupport :: GLiveSupport ::
|
||||
GLiveSupport :: releaseOpennedPlaylists(void) throw ()
|
||||
GLiveSupport :: releaseOpennedPlaylists(void) throw (XmlRpcException)
|
||||
{
|
||||
PlaylistMap::iterator it = opennedPlaylists->begin();
|
||||
PlaylistMap::iterator end = opennedPlaylists->end();
|
||||
|
@ -911,7 +911,7 @@ GLiveSupport :: uploadPlaylistArchive(Ptr<const Glib::ustring>::Ref path)
|
|||
void
|
||||
LiveSupport :: GLiveSupport ::
|
||||
GLiveSupport :: addToScratchpad(Ptr<Playable>::Ref playable)
|
||||
throw ()
|
||||
throw (XmlRpcException)
|
||||
{
|
||||
if (playable->getType() == Playable::AudioClipType) {
|
||||
acquireAudioClip(playable->getId());
|
||||
|
@ -1631,7 +1631,7 @@ LiveSupport :: GLiveSupport ::
|
|||
GLiveSupport :: uploadToHub(Ptr<Playable>::Ref playable)
|
||||
throw ()
|
||||
{
|
||||
masterPanel->updateSearchWindow(playable);
|
||||
masterPanel->uploadToHub(playable);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -294,7 +294,8 @@ class GLiveSupport : public LocalizedConfigurable,
|
|||
* @param id the id of the playlist to remove.
|
||||
*/
|
||||
void
|
||||
uncachePlaylist(Ptr<const UniqueId>::Ref id) throw ();
|
||||
uncachePlaylist(Ptr<const UniqueId>::Ref id)
|
||||
throw (XmlRpcException);
|
||||
|
||||
/**
|
||||
* The list of keyboard shortcuts for the various windows.
|
||||
|
@ -373,8 +374,14 @@ class GLiveSupport : public LocalizedConfigurable,
|
|||
if (cuePlayer.get()) {
|
||||
cuePlayer->deInitialize();
|
||||
}
|
||||
releaseOpennedAudioClips();
|
||||
releaseOpennedPlaylists();
|
||||
try {
|
||||
releaseOpennedAudioClips();
|
||||
} catch (XmlRpcException &e) {
|
||||
}
|
||||
try {
|
||||
releaseOpennedPlaylists();
|
||||
} catch(XmlRpcException &e) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -558,7 +565,8 @@ class GLiveSupport : public LocalizedConfigurable,
|
|||
* @param playable the audio clip or playlist to be added
|
||||
*/
|
||||
void
|
||||
addToScratchpad(Ptr<Playable>::Ref playable) throw ();
|
||||
addToScratchpad(Ptr<Playable>::Ref playable)
|
||||
throw (XmlRpcException);
|
||||
|
||||
/**
|
||||
* Reset the storage behind GLiveSupport.
|
||||
|
@ -706,13 +714,13 @@ class GLiveSupport : public LocalizedConfigurable,
|
|||
* Release all openned audio clips.
|
||||
*/
|
||||
void
|
||||
releaseOpennedAudioClips(void) throw ();
|
||||
releaseOpennedAudioClips(void) throw (XmlRpcException);
|
||||
|
||||
/**
|
||||
* Release all openned playlists.
|
||||
*/
|
||||
void
|
||||
releaseOpennedPlaylists(void) throw ();
|
||||
releaseOpennedPlaylists(void) throw (XmlRpcException);
|
||||
|
||||
/**
|
||||
* Add a file to the Live Mode, and update it.
|
||||
|
|
|
@ -109,7 +109,7 @@ const std::string password = "q";
|
|||
* Set up the test environment
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
GLiveSupportTest :: setUp(void) throw ()
|
||||
GLiveSupportTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||
{
|
||||
Gtk::Main kit(0, 0);
|
||||
|
||||
|
@ -146,7 +146,9 @@ GLiveSupportTest :: setUp(void) throw ()
|
|||
}
|
||||
ifs.close();
|
||||
|
||||
gLiveSupport->resetStorage();
|
||||
CPPUNIT_ASSERT_NO_THROW(
|
||||
gLiveSupport->resetStorage();
|
||||
);
|
||||
|
||||
if (!gLiveSupport->login(login, password)) {
|
||||
std::cerr << "gLiveSupport unable to log in" << std::endl;
|
||||
|
|
|
@ -136,7 +136,7 @@ class GLiveSupportTest : public BaseTestMethod
|
|||
* Set up the environment for the test case.
|
||||
*/
|
||||
void
|
||||
setUp(void) throw ();
|
||||
setUp(void) throw (CPPUNIT_NS::Exception);
|
||||
|
||||
/**
|
||||
* Clean up the environment after the test case.
|
||||
|
|
|
@ -287,7 +287,12 @@ LiveModeWindow :: onOutputPlay(void) throw ()
|
|||
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
||||
gLiveSupport->setNowPlaying(playable);
|
||||
treeView->removeItem(iter);
|
||||
gLiveSupport->playOutputAudio(playable);
|
||||
try {
|
||||
gLiveSupport->playOutputAudio(playable);
|
||||
} catch (std::logic_error &e) {
|
||||
std::cerr << "cannot play on live mode output device: "
|
||||
<< e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -548,17 +548,27 @@ MasterPanelWindow :: updateSchedulerWindow(
|
|||
std::cerr << e.what() << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
schedulerWindow.reset(new SchedulerWindow(gLiveSupport,
|
||||
bundle,
|
||||
schedulerButton));
|
||||
|
||||
try {
|
||||
schedulerWindow.reset(new SchedulerWindow(gLiveSupport,
|
||||
bundle,
|
||||
schedulerButton));
|
||||
} catch (XmlRpcException &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (time.get()) {
|
||||
schedulerWindow->setTime(time);
|
||||
}
|
||||
|
||||
schedulerWindow->showContents();
|
||||
try {
|
||||
schedulerWindow->showContents();
|
||||
} catch (XmlRpcException &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!schedulerWindow->is_visible()) {
|
||||
schedulerWindow->show();
|
||||
|
@ -570,8 +580,7 @@ MasterPanelWindow :: updateSchedulerWindow(
|
|||
* The event when the Search button has been clicked.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
MasterPanelWindow :: updateSearchWindow(Ptr<Playable>::Ref playable)
|
||||
throw ()
|
||||
MasterPanelWindow :: updateSearchWindow(void) throw ()
|
||||
{
|
||||
if (!searchWindow.get()) {
|
||||
Ptr<ResourceBundle>::Ref bundle;
|
||||
|
@ -587,12 +596,7 @@ MasterPanelWindow :: updateSearchWindow(Ptr<Playable>::Ref playable)
|
|||
searchButton));
|
||||
}
|
||||
|
||||
bool dontWantUploadOrItWasOK = true;
|
||||
if (playable) {
|
||||
dontWantUploadOrItWasOK = searchWindow->uploadToHub(playable);
|
||||
}
|
||||
|
||||
if (dontWantUploadOrItWasOK && !searchWindow->is_visible()) {
|
||||
if (!searchWindow->is_visible()) {
|
||||
searchWindow->show();
|
||||
}
|
||||
}
|
||||
|
@ -817,3 +821,33 @@ MasterPanelWindow :: onKeyPressed(GdkEventKey * event) throw ()
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The event when the Search button has been clicked.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
MasterPanelWindow :: uploadToHub(Ptr<Playable>::Ref playable)
|
||||
throw ()
|
||||
{
|
||||
if (!searchWindow.get()) {
|
||||
Ptr<ResourceBundle>::Ref bundle;
|
||||
try {
|
||||
bundle = getBundle("searchWindow");
|
||||
} catch (std::invalid_argument &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
searchWindow.reset(new SearchWindow(gLiveSupport,
|
||||
bundle,
|
||||
searchButton));
|
||||
}
|
||||
|
||||
bool success = searchWindow->uploadToHub(playable);
|
||||
|
||||
if (success && !searchWindow->is_visible()) {
|
||||
searchWindow->show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -495,14 +495,9 @@ class MasterPanelWindow : public Gtk::Window, public LocalizedObject
|
|||
|
||||
/**
|
||||
* Update the Search Window.
|
||||
*
|
||||
* @param playable (optional) add this item to the pending "upload
|
||||
* to hub" tasks displayed in the Transports tab.
|
||||
*/
|
||||
void
|
||||
updateSearchWindow(Ptr<Playable>::Ref playable
|
||||
= Ptr<Playable>::Ref())
|
||||
throw ();
|
||||
updateSearchWindow(void) throw ();
|
||||
|
||||
/**
|
||||
* Update the Options Window
|
||||
|
@ -525,6 +520,16 @@ class MasterPanelWindow : public Gtk::Window, public LocalizedObject
|
|||
*/
|
||||
void
|
||||
setNowPlaying(Ptr<Playable>::Ref playable) throw ();
|
||||
|
||||
/**
|
||||
* Upload a Playable object to the network hub.
|
||||
* And display it in the Transports tab of the Search Window.
|
||||
*
|
||||
* @param playable the audio clip or playlist to be uploaded.
|
||||
*/
|
||||
void
|
||||
uploadToHub(Ptr<Playable>::Ref playable) throw ();
|
||||
|
||||
};
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
|
|
@ -73,7 +73,7 @@ SchedulerWindow :: SchedulerWindow (
|
|||
Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||
Ptr<ResourceBundle>::Ref bundle,
|
||||
Button * windowOpenerButton)
|
||||
throw ()
|
||||
throw (XmlRpcException)
|
||||
: GuiWindow(gLiveSupport,
|
||||
bundle,
|
||||
WidgetConstants::schedulerWindowTitleImage,
|
||||
|
@ -258,7 +258,10 @@ SchedulerWindow :: onDateSelected (void) throw ()
|
|||
showContents();
|
||||
}
|
||||
} catch (std::out_of_range &e) {
|
||||
// TODO: report error
|
||||
// TODO: report date out of range error
|
||||
std::cerr << e.what() << std::endl;
|
||||
} catch (std::out_of_range &e) {
|
||||
// TODO: report storage server error
|
||||
std::cerr << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
|
@ -280,7 +283,7 @@ SchedulerWindow :: setTime(Ptr<boost::posix_time::ptime>::Ref time)
|
|||
* date
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
SchedulerWindow :: showContents(void) throw ()
|
||||
SchedulerWindow :: showContents(void) throw (XmlRpcException)
|
||||
{
|
||||
calendar->select_month(selectedDate->month() - 1, selectedDate->year());
|
||||
calendar->select_day(selectedDate->day());
|
||||
|
@ -372,7 +375,12 @@ SchedulerWindow :: onDeleteItem(void) throw ()
|
|||
} catch (XmlRpcException &e) {
|
||||
// TODO: signal error here
|
||||
}
|
||||
showContents();
|
||||
|
||||
try {
|
||||
showContents();
|
||||
} catch (XmlRpcException &e) {
|
||||
// TODO: signal error here
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -266,7 +266,7 @@ class SchedulerWindow : public GuiWindow
|
|||
SchedulerWindow(Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||
Ptr<ResourceBundle>::Ref bundle,
|
||||
Button * windowOpenerButton)
|
||||
throw ();
|
||||
throw (XmlRpcException);
|
||||
|
||||
/**
|
||||
* Virtual destructor.
|
||||
|
@ -288,7 +288,7 @@ class SchedulerWindow : public GuiWindow
|
|||
* Update the display, with regards to the currently selected day.
|
||||
*/
|
||||
virtual void
|
||||
showContents(void) throw ();
|
||||
showContents(void) throw (XmlRpcException);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -289,7 +289,14 @@ ScratchpadWindow :: onAddToPlaylistButtonClicked (void) throw ()
|
|||
Gtk::TreeIter ti = treeModel->get_iter(*iter);
|
||||
if (ti) {
|
||||
Ptr<Playable>::Ref playable = (*ti)[modelColumns.playableColumn];
|
||||
gLiveSupport->addToPlaylist(playable->getId());
|
||||
try {
|
||||
gLiveSupport->addToPlaylist(playable->getId());
|
||||
} catch (XmlRpcException &e) {
|
||||
// just ignore the bad items
|
||||
std::cerr << "error in ScratchpadWindow::"
|
||||
"onAddToPlaylistButtonClicked(): "
|
||||
<< e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -445,7 +452,13 @@ void
|
|||
ScratchpadWindow :: onAddToPlaylist(void) throw ()
|
||||
{
|
||||
Ptr<Playable>::Ref playable = currentRow[modelColumns.playableColumn];
|
||||
gLiveSupport->addToPlaylist(playable->getId());
|
||||
try {
|
||||
gLiveSupport->addToPlaylist(playable->getId());
|
||||
} catch (XmlRpcException &e) {
|
||||
std::cerr << "error in ScratchpadWindow::onAddToPlaylist(): "
|
||||
<< e.what() << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -458,21 +471,28 @@ ScratchpadWindow :: onSchedulePlaylist(void) throw ()
|
|||
{
|
||||
Ptr<Playable>::Ref playable = currentRow[modelColumns.playableColumn];
|
||||
Ptr<UniqueId>::Ref uid = playable->getId();
|
||||
|
||||
if (!gLiveSupport->existsPlaylist(uid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Ptr<Playlist>::Ref playlist = gLiveSupport->getPlaylist(uid);
|
||||
|
||||
|
||||
Ptr<ResourceBundle>::Ref bundle;
|
||||
Ptr<Playlist>::Ref playlist;
|
||||
|
||||
try {
|
||||
bundle = gLiveSupport->getBundle("schedulePlaylistWindow");
|
||||
if (!gLiveSupport->existsPlaylist(uid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
playlist = gLiveSupport->getPlaylist(uid);
|
||||
|
||||
bundle = gLiveSupport->getBundle("schedulePlaylistWindow");
|
||||
|
||||
} catch (std::invalid_argument &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
return;
|
||||
} catch (XmlRpcException &e) {
|
||||
std::cerr << "error in ScratchpadWindow::onSchedulePlaylist(): "
|
||||
<< e.what() << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// TODO: this should be somewhere else; figure out where
|
||||
Ptr<SchedulePlaylistWindow>::Ref scheduleWindow;
|
||||
scheduleWindow.reset(new SchedulePlaylistWindow(gLiveSupport,
|
||||
|
@ -505,13 +525,17 @@ ScratchpadWindow :: onExportPlaylist(void) throw ()
|
|||
Ptr<Playable>::Ref playable = currentRow[modelColumns.playableColumn];
|
||||
Ptr<Playlist>::Ref playlist = playable->getPlaylist();
|
||||
|
||||
if (playlist) {
|
||||
exportPlaylistWindow.reset(new ExportPlaylistWindow(
|
||||
try {
|
||||
if (playlist) {
|
||||
exportPlaylistWindow.reset(new ExportPlaylistWindow(
|
||||
gLiveSupport,
|
||||
gLiveSupport->getBundle("exportPlaylistWindow"),
|
||||
playlist));
|
||||
exportPlaylistWindow->set_transient_for(*this);
|
||||
Gtk::Main::run(*exportPlaylistWindow);
|
||||
exportPlaylistWindow->set_transient_for(*this);
|
||||
Gtk::Main::run(*exportPlaylistWindow);
|
||||
}
|
||||
} catch (std::invalid_argument &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -609,6 +633,17 @@ void
|
|||
ScratchpadWindow :: addItem(Ptr<Playable>::Ref playable)
|
||||
throw ()
|
||||
{
|
||||
// cache the item if it hasn't been cached yet
|
||||
if (!playable->getToken()) {
|
||||
try {
|
||||
gLiveSupport->acquirePlayable(playable->getId());
|
||||
} catch (XmlRpcException &e) {
|
||||
std::cerr << "could not acquire playable in ScratchpadWindow: "
|
||||
<< e.what() << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
removeItem(playable->getId());
|
||||
|
||||
Gtk::TreeModel::Row row = *treeModel->prepend();
|
||||
|
@ -631,11 +666,6 @@ ScratchpadWindow :: addItem(Ptr<Playable>::Ref playable)
|
|||
|
||||
row[modelColumns.titleColumn] = Glib::Markup::escape_text(
|
||||
*playable->getTitle());
|
||||
|
||||
// cache the item if it hasn't been cached yet
|
||||
if (!playable->getToken()) {
|
||||
gLiveSupport->acquirePlayable(playable->getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -646,7 +676,15 @@ void
|
|||
ScratchpadWindow :: addItem(Ptr<const UniqueId>::Ref id)
|
||||
throw ()
|
||||
{
|
||||
Ptr<Playable>::Ref playable = gLiveSupport->acquirePlayable(id);
|
||||
Ptr<Playable>::Ref playable;
|
||||
try {
|
||||
playable = gLiveSupport->acquirePlayable(id);
|
||||
} catch (XmlRpcException &e) {
|
||||
std::cerr << "could not acquire playable in ScratchpadWindow: "
|
||||
<< e.what() << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
addItem(playable);
|
||||
}
|
||||
|
||||
|
|
|
@ -702,7 +702,12 @@ SearchWindow :: onAddToScratchpad(void) throw ()
|
|||
if (iter) {
|
||||
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
||||
if (playable) {
|
||||
gLiveSupport->addToScratchpad(playable);
|
||||
try {
|
||||
gLiveSupport->addToScratchpad(playable);
|
||||
} catch (XmlRpcException &e) {
|
||||
std::cerr << "error in SearchWindow::onAddToScratchpad(): "
|
||||
<< e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -722,7 +727,12 @@ SearchWindow :: onAddToLiveMode(void) throw ()
|
|||
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
||||
if (playable) {
|
||||
gLiveSupport->addToLiveMode(playable);
|
||||
gLiveSupport->addToScratchpad(playable);
|
||||
try {
|
||||
gLiveSupport->addToScratchpad(playable);
|
||||
} catch (XmlRpcException &e) {
|
||||
std::cerr << "error in SearchWindow::onAddToLiveMode(): "
|
||||
<< e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -744,10 +754,15 @@ SearchWindow :: onExportPlaylist(void) throw ()
|
|||
if (playable) {
|
||||
Ptr<Playlist>::Ref playlist = playable->getPlaylist();
|
||||
if (playlist) {
|
||||
exportPlaylistWindow.reset(new ExportPlaylistWindow(
|
||||
try {
|
||||
exportPlaylistWindow.reset(new ExportPlaylistWindow(
|
||||
gLiveSupport,
|
||||
gLiveSupport->getBundle("exportPlaylistWindow"),
|
||||
playlist));
|
||||
} catch (XmlRpcException &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
return;
|
||||
}
|
||||
exportPlaylistWindow->set_transient_for(*this);
|
||||
Gtk::Main::run(*exportPlaylistWindow);
|
||||
}
|
||||
|
|
|
@ -318,7 +318,12 @@ SimplePlaylistManagementWindow :: cancelPlaylist(void) throw ()
|
|||
DialogWindow::ButtonType result = dialogWindow->run();
|
||||
switch (result) {
|
||||
case DialogWindow::noButton:
|
||||
gLiveSupport->cancelEditedPlaylist();
|
||||
try {
|
||||
gLiveSupport->cancelEditedPlaylist();
|
||||
} catch (XmlRpcException &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case DialogWindow::yesButton:
|
||||
|
@ -425,7 +430,14 @@ SimplePlaylistManagementWindow :: onTitleEdited(void) throw()
|
|||
{
|
||||
Ptr<Playlist>::Ref playlist = gLiveSupport->getEditedPlaylist();
|
||||
if (!playlist) {
|
||||
playlist = gLiveSupport->openPlaylistForEditing();
|
||||
try {
|
||||
playlist = gLiveSupport->openPlaylistForEditing();
|
||||
} catch (XmlRpcException &e) {
|
||||
std::cerr << "error in SimplePlaylistManagementWindow::"
|
||||
"onTitleEdited(): "
|
||||
<< e.what() << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
Ptr<Glib::ustring>::Ref title(new Glib::ustring(
|
||||
nameEntry->get_text()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue