added more functions to the context menu in the Live Mode window;

removed an unnecessary argument in the SchedulePlaylistWindow;
plus minor formatting changes to the ScratchpadWindow
(all part of #1918)
This commit is contained in:
fgerlits 2006-11-02 14:28:03 +00:00
parent c5b8bbb201
commit d3d817050d
7 changed files with 197 additions and 79 deletions

View File

@ -376,6 +376,58 @@ LiveModeWindow :: onKeyPressed(GdkEventKey * event) throw ()
} }
/*------------------------------------------------------------------------------
* Event handler for the Edit Playlist menu item selected from the
* entry conext menu.
*----------------------------------------------------------------------------*/
void
LiveModeWindow :: onEditPlaylist(void) throw ()
{
Glib::RefPtr<Gtk::TreeView::Selection>
refSelection = treeView->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
LiveModeWindow :: onSchedulePlaylist(void) throw ()
{
Glib::RefPtr<Gtk::TreeView::Selection>
refSelection = treeView->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. * Signal handler for "export playlist" in the context menu.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
@ -401,6 +453,30 @@ LiveModeWindow :: onExportPlaylist(void) throw ()
} }
/*------------------------------------------------------------------------------
* Event handler for the Add To Playlist menu item selected from the
* entry conext menu
*----------------------------------------------------------------------------*/
void
LiveModeWindow :: onAddToPlaylist(void) throw ()
{
Glib::RefPtr<Gtk::TreeView::Selection>
refSelection = treeView->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) {
std::cerr << "error in LiveModeWindow::onAddToPlaylist(): "
<< e.what() << std::endl;
return;
}
}
}
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Signal handler for "upload to hub" in the context menu. * Signal handler for "upload to hub" in the context menu.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
@ -418,20 +494,6 @@ LiveModeWindow :: onUploadToHub(void) throw ()
} }
/*------------------------------------------------------------------------------
* Event handler called when the the window gets hidden.
*----------------------------------------------------------------------------*/
void
LiveModeWindow :: on_hide(void) throw ()
{
if (exportPlaylistWindow) {
exportPlaylistWindow->hide();
}
GuiWindow::on_hide();
}
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Refresh the playlist in the window. * Refresh the playlist in the window.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
@ -466,6 +528,10 @@ LiveModeWindow :: constructAudioClipContextMenu(void) throw ()
*getResourceUstring("cueMenuItem"), *getResourceUstring("cueMenuItem"),
sigc::mem_fun(*cueAudioButtons, sigc::mem_fun(*cueAudioButtons,
&CuePlayer::onPlayItem))); &CuePlayer::onPlayItem)));
contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("addToPlaylistMenuItem"),
sigc::mem_fun(*this,
&LiveModeWindow::onAddToPlaylist)));
contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem( contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("removeMenuItem"), *getResourceUstring("removeMenuItem"),
sigc::mem_fun(*treeView, sigc::mem_fun(*treeView,
@ -503,11 +569,23 @@ LiveModeWindow :: constructPlaylistContextMenu(void) throw ()
*getResourceUstring("cueMenuItem"), *getResourceUstring("cueMenuItem"),
sigc::mem_fun(*cueAudioButtons, sigc::mem_fun(*cueAudioButtons,
&CuePlayer::onPlayItem))); &CuePlayer::onPlayItem)));
contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("addToPlaylistMenuItem"),
sigc::mem_fun(*this,
&LiveModeWindow::onAddToPlaylist)));
contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem( contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("removeMenuItem"), *getResourceUstring("removeMenuItem"),
sigc::mem_fun(*treeView, sigc::mem_fun(*treeView,
&ZebraTreeView::onRemoveMenuOption))); &ZebraTreeView::onRemoveMenuOption)));
contextMenuList.push_back(Gtk::Menu_Helpers::SeparatorElem()); contextMenuList.push_back(Gtk::Menu_Helpers::SeparatorElem());
contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("editPlaylistMenuItem"),
sigc::mem_fun(*this,
&LiveModeWindow::onEditPlaylist)));
contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("schedulePlaylistMenuItem"),
sigc::mem_fun(*this,
&LiveModeWindow::onSchedulePlaylist)));
contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem( contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("exportPlaylistMenuItem"), *getResourceUstring("exportPlaylistMenuItem"),
sigc::mem_fun(*this, sigc::mem_fun(*this,
@ -526,3 +604,20 @@ LiveModeWindow :: constructPlaylistContextMenu(void) throw ()
return contextMenu; return contextMenu;
} }
/*------------------------------------------------------------------------------
* Event handler called when the the window gets hidden.
*----------------------------------------------------------------------------*/
void
LiveModeWindow :: on_hide(void) throw ()
{
if (exportPlaylistWindow) {
exportPlaylistWindow->hide();
}
if (schedulePlaylistWindow) {
schedulePlaylistWindow->hide();
}
GuiWindow::on_hide();
}

View File

@ -55,6 +55,7 @@
#include "CuePlayer.h" #include "CuePlayer.h"
#include "GLiveSupport.h" #include "GLiveSupport.h"
#include "ExportPlaylistWindow.h" #include "ExportPlaylistWindow.h"
#include "SchedulePlaylistWindow.h"
namespace LiveSupport { namespace LiveSupport {
namespace GLiveSupport { namespace GLiveSupport {
@ -85,6 +86,11 @@ class LiveModeWindow : public GuiWindow
*/ */
Ptr<ExportPlaylistWindow>::Ref exportPlaylistWindow; Ptr<ExportPlaylistWindow>::Ref exportPlaylistWindow;
/**
* The Schedule Playlist pop-up window.
*/
Ptr<SchedulePlaylistWindow>::Ref schedulePlaylistWindow;
/** /**
* The cue player widget with play/pause and stop buttons. * The cue player widget with play/pause and stop buttons.
*/ */
@ -217,6 +223,20 @@ class LiveModeWindow : public GuiWindow
bool bool
onKeyPressed(GdkEventKey * event) throw (); onKeyPressed(GdkEventKey * event) 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 * Signal handler for the "export playlist" menu item selected from
* the entry context menu. * the entry context menu.
@ -224,6 +244,13 @@ class LiveModeWindow : public GuiWindow
virtual void virtual void
onExportPlaylist(void) throw (); onExportPlaylist(void) throw ();
/**
* Signal handler for the "add to playlist" menu item selected from
* the entry context menu.
*/
virtual void
onAddToPlaylist(void) throw ();
/** /**
* Signal handler for the "upload to hub" menu item selected from * Signal handler for the "upload to hub" menu item selected from
* the entry context menu. * the entry context menu.

View File

@ -64,12 +64,10 @@ using namespace LiveSupport::GLiveSupport;
SchedulePlaylistWindow :: SchedulePlaylistWindow ( SchedulePlaylistWindow :: SchedulePlaylistWindow (
Ptr<GLiveSupport>::Ref gLiveSupport, Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle, Ptr<ResourceBundle>::Ref bundle,
Button * windowOpenerButton,
Ptr<Playlist>::Ref playlist) Ptr<Playlist>::Ref playlist)
throw () throw ()
: GuiWindow(gLiveSupport, : GuiWindow(gLiveSupport,
bundle, bundle),
windowOpenerButton),
playlist(playlist) playlist(playlist)
{ {
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance(); Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();

View File

@ -159,13 +159,10 @@ class SchedulePlaylistWindow : public GuiWindow
* all the vital info. * all the vital info.
* @param bundle the resource bundle holding the localized * @param bundle the resource bundle holding the localized
* resources for this window. * resources for this window.
* @param windowOpenerButton the button which was pressed to open
* this window.
* @param playlist the playlist to schedule. * @param playlist the playlist to schedule.
*/ */
SchedulePlaylistWindow(Ptr<GLiveSupport>::Ref gLiveSupport, SchedulePlaylistWindow(Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle, Ptr<ResourceBundle>::Ref bundle,
Button * windowOpenerButton,
Ptr<Playlist>::Ref playlist) Ptr<Playlist>::Ref playlist)
throw (); throw ();

View File

@ -429,24 +429,6 @@ ScratchpadWindow :: onEditPlaylist(void) throw ()
} }
/*------------------------------------------------------------------------------
* Event handler for the Add To Playlist menu item selected from the
* entry conext menu
*----------------------------------------------------------------------------*/
void
ScratchpadWindow :: onAddToPlaylist(void) throw ()
{
Ptr<Playable>::Ref playable = currentRow[modelColumns.playableColumn];
try {
gLiveSupport->addToPlaylist(playable->getId());
} catch (XmlRpcException &e) {
std::cerr << "error in ScratchpadWindow::onAddToPlaylist(): "
<< e.what() << std::endl;
return;
}
}
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Event handler for the Schedule Playlist menu item selected from the * Event handler for the Schedule Playlist menu item selected from the
* entry conext menu * entry conext menu
@ -480,25 +462,12 @@ ScratchpadWindow :: onSchedulePlaylist(void) throw ()
schedulePlaylistWindow.reset(new SchedulePlaylistWindow(gLiveSupport, schedulePlaylistWindow.reset(new SchedulePlaylistWindow(gLiveSupport,
bundle, bundle,
0, /* no button */
playlist)); playlist));
Gtk::Main::run(*schedulePlaylistWindow); Gtk::Main::run(*schedulePlaylistWindow);
} }
/*------------------------------------------------------------------------------
* Event handler for the Add To Live Mode menu item selected from the
* entry conext menu
*----------------------------------------------------------------------------*/
void
ScratchpadWindow :: onAddToLiveMode(void) throw ()
{
Ptr<Playable>::Ref playable = currentRow[modelColumns.playableColumn];
gLiveSupport->addToLiveMode(playable);
}
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Signal handler for "export playlist" in the context menu. * Signal handler for "export playlist" in the context menu.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
@ -523,6 +492,36 @@ ScratchpadWindow :: onExportPlaylist(void) throw ()
} }
/*------------------------------------------------------------------------------
* Event handler for the Add To Playlist menu item selected from the
* entry conext menu
*----------------------------------------------------------------------------*/
void
ScratchpadWindow :: onAddToPlaylist(void) throw ()
{
Ptr<Playable>::Ref playable = currentRow[modelColumns.playableColumn];
try {
gLiveSupport->addToPlaylist(playable->getId());
} catch (XmlRpcException &e) {
std::cerr << "error in ScratchpadWindow::onAddToPlaylist(): "
<< e.what() << std::endl;
return;
}
}
/*------------------------------------------------------------------------------
* Event handler for the Add To Live Mode menu item selected from the
* entry conext menu
*----------------------------------------------------------------------------*/
void
ScratchpadWindow :: onAddToLiveMode(void) throw ()
{
Ptr<Playable>::Ref playable = currentRow[modelColumns.playableColumn];
gLiveSupport->addToLiveMode(playable);
}
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Signal handler for "upload to hub" in the context menu. * Signal handler for "upload to hub" in the context menu.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/

View File

@ -293,11 +293,25 @@ class ScratchpadWindow : public GuiWindow,
/** /**
* Signal handler for the "edit playlist" menu item selected from * Signal handler for the "edit playlist" menu item selected from
* the entry context menu. * the entry context menu. For playlists only.
*/ */
virtual void virtual void
onEditPlaylist(void) throw (); onEditPlaylist(void) throw ();
/**
* Signal handler for the "schedule playlist" menu item selected
* from the entry context menu. For playlists only.
*/
virtual void
onSchedulePlaylist(void) throw ();
/**
* Signal handler for the "export playlist" menu item selected from
* the entry context menu. For playlists only.
*/
virtual void
onExportPlaylist(void) throw ();
/** /**
* Signal handler for the "add to playlist" menu item selected from * Signal handler for the "add to playlist" menu item selected from
* the entry context menu. * the entry context menu.
@ -305,13 +319,6 @@ class ScratchpadWindow : public GuiWindow,
virtual void virtual void
onAddToPlaylist(void) throw (); onAddToPlaylist(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 "add to live mode" menu item selected from * Signal handler for the "add to live mode" menu item selected from
* the entry context menu. * the entry context menu.
@ -319,13 +326,6 @@ class ScratchpadWindow : public GuiWindow,
virtual void virtual void
onAddToLiveMode(void) throw (); onAddToLiveMode(void) throw ();
/**
* Signal handler for the "export playlist" menu item selected from
* the entry context menu.
*/
virtual void
onExportPlaylist(void) throw ();
/** /**
* Signal handler for the "upload to hub" menu item selected from * Signal handler for the "upload to hub" menu item selected from
* the entry context menu. * the entry context menu.

View File

@ -72,16 +72,14 @@ root:table
clearListButtonLabel:string { "Clear list" } clearListButtonLabel:string { "Clear list" }
removeButtonLabel:string { "Remove item(s)" } removeButtonLabel:string { "Remove item(s)" }
upMenuItem:string { "Move _Up" }
downMenuItem:string { "Move D_own" }
removeMenuItem:string { "_Remove" }
editPlaylistMenuItem:string { "_Edit" }
addToPlaylistMenuItem:string { "_Add To Playlist" }
schedulePlaylistMenuItem:string { "_Schedule" }
cueMenuItem:string { "Pre_view" } cueMenuItem:string { "Pre_view" }
addToLiveModeMenuItem:string { "Add To _Live Mode" } addToLiveModeMenuItem:string { "Add to _Live Mode" }
addToPlaylistMenuItem:string { "_Add to Playlist" }
removeMenuItem:string { "_Remove" }
editPlaylistMenuItem:string { "_Edit Playlist" }
schedulePlaylistMenuItem:string { "_Schedule Playlist" }
exportPlaylistMenuItem:string { "E_xport Playlist" } exportPlaylistMenuItem:string { "E_xport Playlist" }
uploadToHubMenuItem:string { "Upload to the network hub" } uploadToHubMenuItem:string { "Upload to Network Hub" }
cannotEditPlaylistMsg:string cannotEditPlaylistMsg:string
{ "Could not open playlist for editing." } { "Could not open playlist for editing." }
@ -245,15 +243,19 @@ root:table
{ {
windowTitle:string { "Live Mode" } windowTitle:string { "Live Mode" }
cueMenuItem:string { "Pre_view" }
upMenuItem:string { "Move _Up" }
downMenuItem:string { "Move D_own" }
removeMenuItem:string { "_Remove" }
playMenuItem:string { "_Play" } playMenuItem:string { "_Play" }
cueMenuItem:string { "Pre_view" }
addToPlaylistMenuItem:string { "_Add to Playlist" }
removeMenuItem:string { "_Remove" }
editPlaylistMenuItem:string { "_Edit Playlist" }
schedulePlaylistMenuItem:string { "_Schedule Playlist" }
exportPlaylistMenuItem:string { "E_xport Playlist" } exportPlaylistMenuItem:string { "E_xport Playlist" }
uploadToHubMenuItem:string { "Upload to the network hub" } uploadToHubMenuItem:string { "Upload to Network Hub" }
cuePlayerLabel:string { "Preview" } cuePlayerLabel:string { "Preview" }
cannotEditPlaylistMsg:string
{ "Could not open playlist for editing." }
} }
optionsWindow:table optionsWindow:table