From c4a4053d1750fac867bcc198920619f7fecd6587 Mon Sep 17 00:00:00 2001 From: fgerlits Date: Wed, 12 Apr 2006 17:51:39 +0000 Subject: [PATCH] progress towards #1648 --- .../gLiveSupport/src/ExportPlaylistWindow.cxx | 9 ++-- .../gLiveSupport/src/LiveModeWindow.cxx | 30 +++++++++++ .../gLiveSupport/src/LiveModeWindow.h | 7 +++ .../gLiveSupport/src/ScratchpadWindow.cxx | 25 +++++++++ .../gLiveSupport/src/ScratchpadWindow.h | 7 +++ .../gLiveSupport/src/SearchWindow.cxx | 30 +++++++++++ .../products/gLiveSupport/src/SearchWindow.h | 7 +++ .../src/products/gLiveSupport/var/root.txt | 52 ++++++++++++------- 8 files changed, 142 insertions(+), 25 deletions(-) diff --git a/livesupport/src/products/gLiveSupport/src/ExportPlaylistWindow.cxx b/livesupport/src/products/gLiveSupport/src/ExportPlaylistWindow.cxx index 25d486d66..b1d80c871 100644 --- a/livesupport/src/products/gLiveSupport/src/ExportPlaylistWindow.cxx +++ b/livesupport/src/products/gLiveSupport/src/ExportPlaylistWindow.cxx @@ -125,16 +125,15 @@ ExportPlaylistWindow :: ExportPlaylistWindow ( Gtk::Label * statusBar = Gtk::manage(new Gtk::Label("")); Gtk::Box * layout = Gtk::manage(new Gtk::VBox); - layout->pack_start(*extraSpace, Gtk::PACK_SHRINK, 5); + layout->pack_start(*extraSpace, Gtk::PACK_SHRINK, 5); layout->pack_start(*playlistTitleBox, Gtk::PACK_SHRINK, 5); - layout->pack_start(*formatBox, Gtk::PACK_SHRINK, 5); - layout->pack_start(*buttonBox, Gtk::PACK_SHRINK, 5); - layout->pack_start(*statusBar, Gtk::PACK_SHRINK, 5); + layout->pack_start(*formatBox, Gtk::PACK_SHRINK, 0); + layout->pack_start(*statusBar, Gtk::PACK_SHRINK, 10); + layout->pack_start(*buttonBox, Gtk::PACK_SHRINK, 0); add(*layout); set_name(windowName); - set_default_size(200, 200); show_all(); } diff --git a/livesupport/src/products/gLiveSupport/src/LiveModeWindow.cxx b/livesupport/src/products/gLiveSupport/src/LiveModeWindow.cxx index 6ff6fa5bd..38b429260 100644 --- a/livesupport/src/products/gLiveSupport/src/LiveModeWindow.cxx +++ b/livesupport/src/products/gLiveSupport/src/LiveModeWindow.cxx @@ -40,6 +40,8 @@ #include "LiveSupport/Core/TimeConversion.h" #include "LiveSupport/Widgets/WidgetFactory.h" #include "SchedulePlaylistWindow.h" +#include "ExportPlaylistWindow.h" + #include "LiveModeWindow.h" @@ -182,6 +184,10 @@ LiveModeWindow :: LiveModeWindow (Ptr::Ref gLiveSupport, *getResourceUstring("playMenuItem"), sigc::mem_fun(*this, &LiveModeWindow::onOutputPlay))); + contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem( + *getResourceUstring("exportPlaylistMenuItem"), + sigc::mem_fun(*this, + &LiveModeWindow::onExportPlaylist))); } catch (std::invalid_argument &e) { std::cerr << e.what() << std::endl; std::exit(1); @@ -368,3 +374,27 @@ LiveModeWindow :: onKeyPressed(GdkEventKey * event) throw () return false; } + +/*------------------------------------------------------------------------------ + * Signal handler for "export playlist" in the context menu. + *----------------------------------------------------------------------------*/ +void +LiveModeWindow :: onExportPlaylist(void) throw () +{ + Glib::RefPtr + refSelection = treeView->get_selection(); + Gtk::TreeModel::iterator iter = refSelection->get_selected(); + + if (iter) { + Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; + Ptr::Ref playlist = playable->getPlaylist(); + if (playlist) { + Ptr::Ref dialog(new ExportPlaylistWindow( + gLiveSupport, + gLiveSupport->getBundle("exportPlaylistWindow"), + playlist)); + Gtk::Main::run(*dialog); + } + } +} + diff --git a/livesupport/src/products/gLiveSupport/src/LiveModeWindow.h b/livesupport/src/products/gLiveSupport/src/LiveModeWindow.h index f87fc3b6a..7573df284 100644 --- a/livesupport/src/products/gLiveSupport/src/LiveModeWindow.h +++ b/livesupport/src/products/gLiveSupport/src/LiveModeWindow.h @@ -186,6 +186,13 @@ class LiveModeWindow : public GuiWindow bool onKeyPressed(GdkEventKey * event) throw (); + /** + * Signal handler for the "export playlist" menu item selected from + * the entry context menu. + */ + virtual void + onExportPlaylist(void) throw (); + public: /** diff --git a/livesupport/src/products/gLiveSupport/src/ScratchpadWindow.cxx b/livesupport/src/products/gLiveSupport/src/ScratchpadWindow.cxx index 2576b7935..311c2dab1 100644 --- a/livesupport/src/products/gLiveSupport/src/ScratchpadWindow.cxx +++ b/livesupport/src/products/gLiveSupport/src/ScratchpadWindow.cxx @@ -39,6 +39,8 @@ #include "LiveSupport/Widgets/WidgetFactory.h" #include "LiveSupport/Widgets/ZebraTreeView.h" #include "SchedulePlaylistWindow.h" +#include "ExportPlaylistWindow.h" + #include "ScratchpadWindow.h" @@ -241,6 +243,10 @@ ScratchpadWindow :: ScratchpadWindow ( *getResourceUstring("addToLiveModeMenuItem"), sigc::mem_fun(*this, &ScratchpadWindow::onAddToLiveMode))); + playlistMenuList.push_back(Gtk::Menu_Helpers::MenuElem( + *getResourceUstring("exportPlaylistMenuItem"), + sigc::mem_fun(*this, + &ScratchpadWindow::onExportPlaylist))); } catch (std::invalid_argument &e) { std::cerr << e.what() << std::endl; std::exit(1); @@ -483,6 +489,25 @@ ScratchpadWindow :: onAddToLiveMode(void) throw () } +/*------------------------------------------------------------------------------ + * Signal handler for "export playlist" in the context menu. + *----------------------------------------------------------------------------*/ +void +ScratchpadWindow :: onExportPlaylist(void) throw () +{ + Ptr::Ref playable = currentRow[modelColumns.playableColumn]; + Ptr::Ref playlist = playable->getPlaylist(); + + if (playlist) { + Ptr::Ref dialog(new ExportPlaylistWindow( + gLiveSupport, + gLiveSupport->getBundle("exportPlaylistWindow"), + playlist)); + Gtk::Main::run(*dialog); + } +} + + /*------------------------------------------------------------------------------ * Signal handler for the user double-clicking or pressing Enter. *----------------------------------------------------------------------------*/ diff --git a/livesupport/src/products/gLiveSupport/src/ScratchpadWindow.h b/livesupport/src/products/gLiveSupport/src/ScratchpadWindow.h index 92c689b47..58fb21625 100644 --- a/livesupport/src/products/gLiveSupport/src/ScratchpadWindow.h +++ b/livesupport/src/products/gLiveSupport/src/ScratchpadWindow.h @@ -307,6 +307,13 @@ 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 (); + public: /** diff --git a/livesupport/src/products/gLiveSupport/src/SearchWindow.cxx b/livesupport/src/products/gLiveSupport/src/SearchWindow.cxx index 9c6f6db8f..b3a1c94ba 100644 --- a/livesupport/src/products/gLiveSupport/src/SearchWindow.cxx +++ b/livesupport/src/products/gLiveSupport/src/SearchWindow.cxx @@ -42,6 +42,8 @@ #include "LiveSupport/Widgets/ScrolledNotebook.h" #include "LiveSupport/Widgets/Button.h" #include "LiveSupport/Widgets/ZebraTreeView.h" +#include "ExportPlaylistWindow.h" + #include "SearchWindow.h" @@ -273,6 +275,10 @@ SearchWindow :: constructSearchResultsView(void) throw () *getResourceUstring("addToLiveModeMenuItem"), sigc::mem_fun(*this, &SearchWindow::onAddToLiveMode))); + contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem( + *getResourceUstring("exportPlaylistMenuItem"), + sigc::mem_fun(*this, + &SearchWindow::onExportPlaylist))); } catch (std::invalid_argument &e) { std::cerr << e.what() << std::endl; std::exit(1); @@ -478,6 +484,30 @@ SearchWindow :: onAddToLiveMode(void) throw () } +/*------------------------------------------------------------------------------ + * Signal handler for "export playlist" in the context menu. + *----------------------------------------------------------------------------*/ +void +SearchWindow :: onExportPlaylist(void) throw () +{ + Glib::RefPtr + refSelection = searchResults->get_selection(); + Gtk::TreeModel::iterator iter = refSelection->get_selected(); + + if (iter) { + Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; + Ptr::Ref playlist = playable->getPlaylist(); + if (playlist) { + Ptr::Ref dialog(new ExportPlaylistWindow( + gLiveSupport, + gLiveSupport->getBundle("exportPlaylistWindow"), + playlist)); + Gtk::Main::run(*dialog); + } + } +} + + /*------------------------------------------------------------------------------ * Signal handler for the user double-clicking or pressing Enter. *----------------------------------------------------------------------------*/ diff --git a/livesupport/src/products/gLiveSupport/src/SearchWindow.h b/livesupport/src/products/gLiveSupport/src/SearchWindow.h index e44263b80..c0591381c 100644 --- a/livesupport/src/products/gLiveSupport/src/SearchWindow.h +++ b/livesupport/src/products/gLiveSupport/src/SearchWindow.h @@ -187,6 +187,13 @@ class SearchWindow : public GuiWindow void onAddToLiveMode(void) throw (); + /** + * Signal handler for the "export playlist" menu item selected from + * the entry context menu. + */ + virtual void + onExportPlaylist(void) throw (); + /** * The columns model needed by Gtk::TreeView. * Lists one clip per row. diff --git a/livesupport/src/products/gLiveSupport/var/root.txt b/livesupport/src/products/gLiveSupport/var/root.txt index 6892003b4..6955acf12 100644 --- a/livesupport/src/products/gLiveSupport/var/root.txt +++ b/livesupport/src/products/gLiveSupport/var/root.txt @@ -67,17 +67,15 @@ 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" } + 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" } + exportPlaylistMenuItem:string { "E_xport Playlist" } cannotEditPlaylistMsg:string { "Could not open playlist for editing." } @@ -192,10 +190,9 @@ root:table allStringForBrowse { "--- all ---" } - addToScratchpadMenuItem:string - { "_Add To Scratchpad" } - addToLiveModeMenuItem:string - { "Add To _Live Mode" } + addToScratchpadMenuItem:string { "_Add To Scratchpad" } + addToLiveModeMenuItem:string { "Add To _Live Mode" } + exportPlaylistMenuItem:string { "E_xport Playlist" } } advancedSearchEntry:table { @@ -219,11 +216,12 @@ 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" } + upMenuItem:string { "Move _Up" } + downMenuItem:string { "Move D_own" } + removeMenuItem:string { "_Remove" } + playMenuItem:string { "_Play" } + exportPlaylistMenuItem:string { "E_xport Playlist" } cuePlayerLabel:string { "Preview" } } @@ -306,6 +304,20 @@ root:table minuteLabel:string { "minute:" } } + exportPlaylistWindow:table + { + windowTitle:string { "Export Playlist" } + + playlistTitleLabel:string { "Title:" } + formatLabel:string { "Export as:" } + + cancelButtonLabel:string { "Cancel" } + saveButtonLabel:string { "Save" } + + internalFormatName:string { "LiveSupport archive" } + smilFormatName:string { "tar containing a SMIL" } + } + metadataTypes:table { title:string { "Title" }