This commit is contained in:
fgerlits 2006-11-06 16:28:35 +00:00
parent 6456f5a162
commit 959c465bb0
4 changed files with 147 additions and 17 deletions

View File

@ -39,7 +39,6 @@
#include "LiveSupport/Core/TimeConversion.h"
#include "LiveSupport/Widgets/WidgetFactory.h"
#include "SchedulePlaylistWindow.h"
#include "LiveModeWindow.h"

View File

@ -790,9 +790,10 @@ SearchWindow :: onEntryClicked (GdkEventButton * event) throw ()
void
SearchWindow :: onAddToScratchpad(void) throw ()
{
Glib::RefPtr<Gtk::TreeView::Selection> refSelection =
searchResultsTreeView->get_selection();
Gtk::TreeModel::iterator iter = refSelection->get_selected();
Glib::RefPtr<Gtk::TreeView::Selection>
refSelection = searchResultsTreeView->get_selection();
Gtk::TreeModel::iterator
iter = refSelection->get_selected();
if (iter) {
Ptr<Playable>::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<Gtk::TreeView::Selection>
refSelection = searchResultsTreeView->get_selection();
Gtk::TreeModel::iterator
iter = refSelection->get_selected();
if (iter) {
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
try {
gLiveSupport->addToPlaylist(playable->getId());
} catch (XmlRpcException &e) {
Ptr<Glib::ustring>::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<Gtk::TreeView::Selection> refSelection =
searchResultsTreeView->get_selection();
Gtk::TreeModel::iterator iter = refSelection->get_selected();
Glib::RefPtr<Gtk::TreeView::Selection>
refSelection = searchResultsTreeView->get_selection();
Gtk::TreeModel::iterator
iter = refSelection->get_selected();
if (iter) {
Ptr<Playable>::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<Gtk::TreeView::Selection>
refSelection = searchResultsTreeView->get_selection();
Gtk::TreeModel::iterator
iter = refSelection->get_selected();
if (iter) {
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
Ptr<Playlist>::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<Gtk::TreeView::Selection>
refSelection = searchResultsTreeView->get_selection();
Gtk::TreeModel::iterator
iter = refSelection->get_selected();
if (iter) {
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
Ptr<Playlist>::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<Gtk::TreeView::Selection>
refSelection = searchResultsTreeView->get_selection();
refSelection = searchResultsTreeView->get_selection();
Gtk::TreeModel::iterator
iter = refSelection->get_selected();
iter = refSelection->get_selected();
if (iter) {
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
@ -878,12 +960,12 @@ void
SearchWindow :: onUploadToHub(void) throw ()
{
Glib::RefPtr<Gtk::TreeView::Selection>
refSelection = searchResultsTreeView->get_selection();
refSelection = searchResultsTreeView->get_selection();
Gtk::TreeModel::iterator
iter = refSelection->get_selected();
iter = refSelection->get_selected();
if (iter) {
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
if (playable) {
uploadToHub(playable);
}
@ -919,12 +1001,12 @@ void
SearchWindow :: onDownloadFromHub(void) throw ()
{
Glib::RefPtr<Gtk::TreeView::Selection>
refSelection = searchResultsTreeView->get_selection();
refSelection = searchResultsTreeView->get_selection();
Gtk::TreeModel::iterator
iter = refSelection->get_selected();
iter = refSelection->get_selected();
if (iter) {
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
Ptr<Playable>::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,

View File

@ -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<SchedulePlaylistWindow>::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.

View File

@ -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" }