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.
*----------------------------------------------------------------------------*/
@ -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.
*----------------------------------------------------------------------------*/
@ -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.
*----------------------------------------------------------------------------*/
@ -466,6 +528,10 @@ LiveModeWindow :: constructAudioClipContextMenu(void) throw ()
*getResourceUstring("cueMenuItem"),
sigc::mem_fun(*cueAudioButtons,
&CuePlayer::onPlayItem)));
contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("addToPlaylistMenuItem"),
sigc::mem_fun(*this,
&LiveModeWindow::onAddToPlaylist)));
contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("removeMenuItem"),
sigc::mem_fun(*treeView,
@ -503,11 +569,23 @@ LiveModeWindow :: constructPlaylistContextMenu(void) throw ()
*getResourceUstring("cueMenuItem"),
sigc::mem_fun(*cueAudioButtons,
&CuePlayer::onPlayItem)));
contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("addToPlaylistMenuItem"),
sigc::mem_fun(*this,
&LiveModeWindow::onAddToPlaylist)));
contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("removeMenuItem"),
sigc::mem_fun(*treeView,
&ZebraTreeView::onRemoveMenuOption)));
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(
*getResourceUstring("exportPlaylistMenuItem"),
sigc::mem_fun(*this,
@ -526,3 +604,20 @@ LiveModeWindow :: constructPlaylistContextMenu(void) throw ()
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 "GLiveSupport.h"
#include "ExportPlaylistWindow.h"
#include "SchedulePlaylistWindow.h"
namespace LiveSupport {
namespace GLiveSupport {
@ -85,6 +86,11 @@ class LiveModeWindow : public GuiWindow
*/
Ptr<ExportPlaylistWindow>::Ref exportPlaylistWindow;
/**
* The Schedule Playlist pop-up window.
*/
Ptr<SchedulePlaylistWindow>::Ref schedulePlaylistWindow;
/**
* The cue player widget with play/pause and stop buttons.
*/
@ -217,6 +223,20 @@ class LiveModeWindow : public GuiWindow
bool
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
* the entry context menu.
@ -224,6 +244,13 @@ class LiveModeWindow : public GuiWindow
virtual void
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
* the entry context menu.

View File

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

View File

@ -159,13 +159,10 @@ class SchedulePlaylistWindow : public GuiWindow
* all the vital info.
* @param bundle the resource bundle holding the localized
* resources for this window.
* @param windowOpenerButton the button which was pressed to open
* this window.
* @param playlist the playlist to schedule.
*/
SchedulePlaylistWindow(Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle,
Button * windowOpenerButton,
Ptr<Playlist>::Ref playlist)
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
* entry conext menu
@ -480,25 +462,12 @@ ScratchpadWindow :: onSchedulePlaylist(void) throw ()
schedulePlaylistWindow.reset(new SchedulePlaylistWindow(gLiveSupport,
bundle,
0, /* no button */
playlist));
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.
*----------------------------------------------------------------------------*/
@ -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.
*----------------------------------------------------------------------------*/

View File

@ -293,11 +293,25 @@ class ScratchpadWindow : public GuiWindow,
/**
* Signal handler for the "edit playlist" menu item selected from
* the entry context menu.
* the entry context menu. For playlists only.
*/
virtual void
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
* the entry context menu.
@ -305,13 +319,6 @@ class ScratchpadWindow : public GuiWindow,
virtual void
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
* the entry context menu.
@ -319,13 +326,6 @@ class ScratchpadWindow : public GuiWindow,
virtual void
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
* the entry context menu.

View File

@ -72,16 +72,14 @@ root:table
clearListButtonLabel:string { "Clear list" }
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" }
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" }
uploadToHubMenuItem:string { "Upload to the network hub" }
uploadToHubMenuItem:string { "Upload to Network Hub" }
cannotEditPlaylistMsg:string
{ "Could not open playlist for editing." }
@ -245,15 +243,19 @@ root:table
{
windowTitle:string { "Live Mode" }
cueMenuItem:string { "Pre_view" }
upMenuItem:string { "Move _Up" }
downMenuItem:string { "Move D_own" }
removeMenuItem:string { "_Remove" }
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" }
uploadToHubMenuItem:string { "Upload to the network hub" }
uploadToHubMenuItem:string { "Upload to Network Hub" }
cuePlayerLabel:string { "Preview" }
cannotEditPlaylistMsg:string
{ "Could not open playlist for editing." }
}
optionsWindow:table