diff --git a/livesupport/src/modules/storageClient/include/LiveSupport/Storage/StorageClientInterface.h b/livesupport/src/modules/storageClient/include/LiveSupport/Storage/StorageClientInterface.h index 76c065dc0..ea23df63f 100644 --- a/livesupport/src/modules/storageClient/include/LiveSupport/Storage/StorageClientInterface.h +++ b/livesupport/src/modules/storageClient/include/LiveSupport/Storage/StorageClientInterface.h @@ -497,6 +497,44 @@ class StorageClientInterface throw (XmlRpcException) = 0; + /** + * The possible formats of exported playlists. + */ + typedef enum { internalFormat, + smilFormat } ExportFormatType; + + /** + * Initiate the exporting of a playlist. + * + * @param sessionId the session ID from the authentication client. + * @param playlistId the ID of the playlist to be exported. + * @param format the format of the exported playlist. + * @param url return parameter: readable URL pointing to the + * exported playlist. + * @return a token which identifies this export task. + * @exception XmlRpcException if there is a problem with the XML-RPC + * call. + */ + virtual Ptr::Ref + exportPlaylistOpen(Ptr::Ref sessionId, + Ptr::Ref playlistId, + ExportFormatType format, + Ptr::Ref url) const + throw (XmlRpcException) + = 0; + + /** + * Close the playlist export process. + * + * @param token the identifier of this export task. + * @exception XmlRpcException if there is a problem with the XML-RPC + * call. + */ + virtual void + exportPlaylistClose(Ptr::Ref token) const + throw (XmlRpcException) + = 0; + /** * A virtual destructor, as this class has virtual functions. */ diff --git a/livesupport/src/modules/storageClient/src/TestStorageClient.cxx b/livesupport/src/modules/storageClient/src/TestStorageClient.cxx index 13acb3a96..29519a642 100644 --- a/livesupport/src/modules/storageClient/src/TestStorageClient.cxx +++ b/livesupport/src/modules/storageClient/src/TestStorageClient.cxx @@ -1026,3 +1026,30 @@ TestStorageClient :: createBackupClose(const Glib::ustring & token) const { } + +/*------------------------------------------------------------------------------ + * Initiate the exporting of a playlist. + *----------------------------------------------------------------------------*/ +Ptr::Ref +TestStorageClient :: exportPlaylistOpen(Ptr::Ref sessionId, + Ptr::Ref playlistId, + ExportFormatType format, + Ptr::Ref url) const + throw (XmlRpcException) +{ + url->assign("http://some/fake/url"); + Ptr::Ref token(new Glib::ustring("fake token")); + return token; +} + + +/*------------------------------------------------------------------------------ + * Close the playlist export process. + *----------------------------------------------------------------------------*/ +void +TestStorageClient :: exportPlaylistClose( + Ptr::Ref token) const + throw (XmlRpcException) +{ +} + diff --git a/livesupport/src/modules/storageClient/src/TestStorageClient.h b/livesupport/src/modules/storageClient/src/TestStorageClient.h index 4b3693061..88e666eb3 100644 --- a/livesupport/src/modules/storageClient/src/TestStorageClient.h +++ b/livesupport/src/modules/storageClient/src/TestStorageClient.h @@ -638,6 +638,36 @@ class TestStorageClient : virtual void createBackupClose(const Glib::ustring & token) const throw (XmlRpcException); + + /** + * Initiate the exporting of a playlist. + * + * @param sessionId the session ID from the authentication client. + * @param playlistId the ID of the playlist to be exported. + * @param format the format of the exported playlist. + * @param url return parameter: readable URL pointing to the + * exported playlist. + * @return a token which identifies this export task. + * @exception XmlRpcException if there is a problem with the XML-RPC + * call. + */ + virtual Ptr::Ref + exportPlaylistOpen(Ptr::Ref sessionId, + Ptr::Ref playlistId, + ExportFormatType format, + Ptr::Ref url) const + throw (XmlRpcException); + + /** + * Close the playlist export process. + * + * @param token the identifier of this export task. + * @exception XmlRpcException if there is a problem with the XML-RPC + * call. + */ + virtual void + exportPlaylistClose(Ptr::Ref token) const + throw (XmlRpcException); }; diff --git a/livesupport/src/modules/storageClient/src/TestStorageClientTest.cxx b/livesupport/src/modules/storageClient/src/TestStorageClientTest.cxx index 0cacbbe35..42ba9c774 100644 --- a/livesupport/src/modules/storageClient/src/TestStorageClientTest.cxx +++ b/livesupport/src/modules/storageClient/src/TestStorageClientTest.cxx @@ -496,3 +496,41 @@ TestStorageClientTest :: createBackupTest(void) ); } + +/*------------------------------------------------------------------------------ + * Testing the exportPlaylistXxxx() functions. + *----------------------------------------------------------------------------*/ +void +TestStorageClientTest :: exportPlaylistTest(void) + throw (CPPUNIT_NS::Exception) +{ + exportPlaylistHelper(StorageClientInterface::internalFormat); + exportPlaylistHelper(StorageClientInterface::smilFormat); +} + + +/*------------------------------------------------------------------------------ + * Auxiliary function for exportPlaylistTest(). + *----------------------------------------------------------------------------*/ +void +TestStorageClientTest :: exportPlaylistHelper( + StorageClientInterface::ExportFormatType format) + throw (CPPUNIT_NS::Exception) +{ + Ptr::Ref playlistId(new UniqueId(1)); + Ptr::Ref url(new Glib::ustring("")); + Ptr::Ref token; + + CPPUNIT_ASSERT_NO_THROW( + token = tsc->exportPlaylistOpen( + dummySessionId, playlistId, format, url); + ); + CPPUNIT_ASSERT(token); + CPPUNIT_ASSERT(url); + CPPUNIT_ASSERT(*url != ""); + + CPPUNIT_ASSERT_NO_THROW( + tsc->exportPlaylistClose(token); + ); +} + diff --git a/livesupport/src/modules/storageClient/src/TestStorageClientTest.h b/livesupport/src/modules/storageClient/src/TestStorageClientTest.h index f5c43fea7..41c3e20e2 100644 --- a/livesupport/src/modules/storageClient/src/TestStorageClientTest.h +++ b/livesupport/src/modules/storageClient/src/TestStorageClientTest.h @@ -74,6 +74,7 @@ class TestStorageClientTest : public CPPUNIT_NS::TestFixture CPPUNIT_TEST(searchTest); CPPUNIT_TEST(getAllTest); CPPUNIT_TEST(createBackupTest); + CPPUNIT_TEST(exportPlaylistTest); CPPUNIT_TEST_SUITE_END(); private: @@ -87,6 +88,14 @@ class TestStorageClientTest : public CPPUNIT_NS::TestFixture */ Ptr::Ref dummySessionId; + /** + * Auxiliary function for exportPlaylistTest(). + */ + void + exportPlaylistHelper(StorageClientInterface::ExportFormatType format) + throw (CPPUNIT_NS::Exception); + + protected: /** @@ -169,6 +178,14 @@ class TestStorageClientTest : public CPPUNIT_NS::TestFixture void createBackupTest(void) throw (CPPUNIT_NS::Exception); + /** + * Testing the exportPlaylistXxxx() functions. + * + * @exception CPPUNIT_NS::Exception on test failures. + */ + void + exportPlaylistTest(void) throw (CPPUNIT_NS::Exception); + public: diff --git a/livesupport/src/modules/storageClient/src/WebStorageClient.cxx b/livesupport/src/modules/storageClient/src/WebStorageClient.cxx index 0ad517faa..b8d20207c 100644 --- a/livesupport/src/modules/storageClient/src/WebStorageClient.cxx +++ b/livesupport/src/modules/storageClient/src/WebStorageClient.cxx @@ -707,6 +707,51 @@ static const std::string createBackupUrlParamName = "url"; static const std::string createBackupFaultStringParamName = "faultString"; +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ storage server constants: exportPlaylistXxxx */ + +/*------------------------------------------------------------------------------ + * The name of the 'open' export playlist method on the storage server + *----------------------------------------------------------------------------*/ +static const std::string exportPlaylistOpenMethodName + = "locstor.exportPlaylistOpen"; + +/*------------------------------------------------------------------------------ + * The name of the 'close' export playlist method on the storage server + *----------------------------------------------------------------------------*/ +static const std::string exportPlaylistCloseMethodName + = "locstor.exportPlaylistClose"; + +/*------------------------------------------------------------------------------ + * The name of the session ID parameter in the input structure + *----------------------------------------------------------------------------*/ +static const std::string exportPlaylistSessionIdParamName = "sessid"; + +/*------------------------------------------------------------------------------ + * The name of the playlist ID array parameter in the input structure + *----------------------------------------------------------------------------*/ +static const std::string exportPlaylistPlaylistIdArrayParamName = "plids"; + +/*------------------------------------------------------------------------------ + * The name of the format parameter in the input structure + *----------------------------------------------------------------------------*/ +static const std::string exportPlaylistFormatParamName = "type"; + +/*------------------------------------------------------------------------------ + * The name of the 'standalone' parameter in the input structure + *----------------------------------------------------------------------------*/ +static const std::string exportPlaylistStandaloneParamName = "standalone"; + +/*------------------------------------------------------------------------------ + * The name of the URL return parameter in the output structure + *----------------------------------------------------------------------------*/ +static const std::string exportPlaylistUrlParamName = "url"; + +/*------------------------------------------------------------------------------ + * The name of the token parameter in the input and output structures + *----------------------------------------------------------------------------*/ +static const std::string exportPlaylistTokenParamName = "token"; + + /* =============================================== local function prototypes */ @@ -2172,7 +2217,79 @@ WebStorageClient :: createBackupClose(const Glib::ustring & token) const = std::string(token); execute(createBackupCloseMethodName, parameters, result); - - // TODO: check the returned status parameter? for what? +} + + +/*------------------------------------------------------------------------------ + * Initiate the exporting of a playlist. + *----------------------------------------------------------------------------*/ +Ptr::Ref +WebStorageClient :: exportPlaylistOpen(Ptr::Ref sessionId, + Ptr::Ref playlistId, + ExportFormatType format, + Ptr::Ref url) const + throw (XmlRpcException) +{ + XmlRpcValue parameters; + XmlRpcValue result; + + XmlRpcValue playlistIdArray; + playlistIdArray.setSize(1); + playlistIdArray[0] = std::string(*playlistId); + + parameters.clear(); + parameters[exportPlaylistSessionIdParamName] + = sessionId->getId(); + parameters[exportPlaylistPlaylistIdArrayParamName] + = playlistIdArray; + switch (format) { + case internalFormat: parameters[exportPlaylistFormatParamName] + = "lspl"; + break; + + case smilFormat: parameters[exportPlaylistFormatParamName] + = "smil"; + break; + } + parameters[exportPlaylistStandaloneParamName] + = false; + + execute(exportPlaylistOpenMethodName, parameters, result); + + checkStruct(exportPlaylistOpenMethodName, + result, + exportPlaylistUrlParamName, + XmlRpcValue::TypeString); + + url->assign(std::string(result[exportPlaylistUrlParamName])); + + checkStruct(exportPlaylistOpenMethodName, + result, + exportPlaylistTokenParamName, + XmlRpcValue::TypeString); + + Ptr::Ref token(new Glib::ustring( + result[exportPlaylistTokenParamName] )); + + return token; +} + + +/*------------------------------------------------------------------------------ + * Close the playlist export process. + *----------------------------------------------------------------------------*/ +void +WebStorageClient :: exportPlaylistClose( + Ptr::Ref token) const + throw (XmlRpcException) +{ + XmlRpcValue parameters; + XmlRpcValue result; + + parameters.clear(); + parameters[exportPlaylistTokenParamName] + = std::string(*token); + + execute(exportPlaylistCloseMethodName, parameters, result); } diff --git a/livesupport/src/modules/storageClient/src/WebStorageClient.h b/livesupport/src/modules/storageClient/src/WebStorageClient.h index f3c505c7a..cfe1c5ef0 100644 --- a/livesupport/src/modules/storageClient/src/WebStorageClient.h +++ b/livesupport/src/modules/storageClient/src/WebStorageClient.h @@ -714,6 +714,36 @@ class WebStorageClient : virtual void createBackupClose(const Glib::ustring & token) const throw (XmlRpcException); + + /** + * Initiate the exporting of a playlist. + * + * @param sessionId the session ID from the authentication client. + * @param playlistId the ID of the playlist to be exported. + * @param format the format of the exported playlist. + * @param url return parameter: readable URL pointing to the + * exported playlist. + * @return a token which identifies this export task. + * @exception XmlRpcException if there is a problem with the XML-RPC + * call. + */ + virtual Ptr::Ref + exportPlaylistOpen(Ptr::Ref sessionId, + Ptr::Ref playlistId, + ExportFormatType format, + Ptr::Ref url) const + throw (XmlRpcException); + + /** + * Close the playlist export process. + * + * @param token the identifier of this export task. + * @exception XmlRpcException if there is a problem with the XML-RPC + * call. + */ + virtual void + exportPlaylistClose(Ptr::Ref token) const + throw (XmlRpcException); }; diff --git a/livesupport/src/modules/storageClient/src/WebStorageClientTest.cxx b/livesupport/src/modules/storageClient/src/WebStorageClientTest.cxx index a26304749..fb20ee0fd 100644 --- a/livesupport/src/modules/storageClient/src/WebStorageClientTest.cxx +++ b/livesupport/src/modules/storageClient/src/WebStorageClientTest.cxx @@ -860,3 +860,52 @@ WebStorageClientTest :: createBackupTest(void) ); } + +/*------------------------------------------------------------------------------ + * Testing the exportPlaylistXxxx() functions. + *----------------------------------------------------------------------------*/ +void +WebStorageClientTest :: exportPlaylistTest(void) + throw (CPPUNIT_NS::Exception) +{ + exportPlaylistHelper(StorageClientInterface::internalFormat); + exportPlaylistHelper(StorageClientInterface::smilFormat); +} + + +/*------------------------------------------------------------------------------ + * Auxiliary function for exportPlaylistTest(). + *----------------------------------------------------------------------------*/ +void +WebStorageClientTest :: exportPlaylistHelper( + StorageClientInterface::ExportFormatType format) + throw (CPPUNIT_NS::Exception) +{ + Ptr::Ref sessionId; + CPPUNIT_ASSERT_NO_THROW( + sessionId = authentication->login("root", "q"); + ); + CPPUNIT_ASSERT(sessionId); + + Ptr::Ref playlistId(new UniqueId(1)); + Ptr::Ref url(new Glib::ustring("")); + Ptr::Ref token; + + CPPUNIT_ASSERT_NO_THROW( + token = wsc->exportPlaylistOpen(sessionId, playlistId, format, url); + ); + CPPUNIT_ASSERT(token); + CPPUNIT_ASSERT(url); + CPPUNIT_ASSERT(*url != ""); + // TODO: test accessibility of the URL? + + CPPUNIT_ASSERT_NO_THROW( + wsc->exportPlaylistClose(token); + ); + // TODO: test non-accessibility of the URL? + + CPPUNIT_ASSERT_NO_THROW( + authentication->logout(sessionId); + ); +} + diff --git a/livesupport/src/modules/storageClient/src/WebStorageClientTest.h b/livesupport/src/modules/storageClient/src/WebStorageClientTest.h index c2b07d9e9..7b5380c5a 100644 --- a/livesupport/src/modules/storageClient/src/WebStorageClientTest.h +++ b/livesupport/src/modules/storageClient/src/WebStorageClientTest.h @@ -80,6 +80,7 @@ class WebStorageClientTest : public BaseTestMethod CPPUNIT_TEST(getAllTest); CPPUNIT_TEST(browseTest); CPPUNIT_TEST(createBackupTest); + CPPUNIT_TEST(exportPlaylistTest); CPPUNIT_TEST_SUITE_END(); private: @@ -93,6 +94,13 @@ class WebStorageClientTest : public BaseTestMethod */ Ptr::Ref wsc; + /** + * Auxiliary function for exportPlaylistTest(). + */ + void + exportPlaylistHelper(StorageClientInterface::ExportFormatType format) + throw (CPPUNIT_NS::Exception); + protected: /** @@ -175,6 +183,14 @@ class WebStorageClientTest : public BaseTestMethod void createBackupTest(void) throw (CPPUNIT_NS::Exception); + /** + * Testing the exportPlaylistXxxx() functions. + * + * @exception CPPUNIT_NS::Exception on test failures. + */ + void + exportPlaylistTest(void) throw (CPPUNIT_NS::Exception); + public: diff --git a/livesupport/src/modules/widgets/etc/Makefile.in b/livesupport/src/modules/widgets/etc/Makefile.in index 1258d716d..063d5261c 100644 --- a/livesupport/src/modules/widgets/etc/Makefile.in +++ b/livesupport/src/modules/widgets/etc/Makefile.in @@ -148,7 +148,8 @@ WIDGETS_LIB_OBJS = ${TMP_DIR}/ImageButton.o \ ${TMP_DIR}/DialogWindow.o \ ${TMP_DIR}/ScrolledWindow.o \ ${TMP_DIR}/ScrolledNotebook.o \ - ${TMP_DIR}/DateTimeChooserWindow.o + ${TMP_DIR}/DateTimeChooserWindow.o \ + ${TMP_DIR}/RadioButtons.o TEST_EXE_OBJS = ${TMP_DIR}/TestWindow.o \ ${TMP_DIR}/main.o diff --git a/livesupport/src/modules/widgets/include/LiveSupport/Widgets/RadioButtons.h b/livesupport/src/modules/widgets/include/LiveSupport/Widgets/RadioButtons.h new file mode 100644 index 000000000..3e62bda18 --- /dev/null +++ b/livesupport/src/modules/widgets/include/LiveSupport/Widgets/RadioButtons.h @@ -0,0 +1,128 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: fgerlits $ + Version : $Revision$ + Location : $URL: svn+ssh://fgerlits@code.campware.org/home/svn/repo/livesupport/trunk/livesupport/src/modules/widgets/include/LiveSupport/Widgets/RadioButtons.h $ + +------------------------------------------------------------------------------*/ +#ifndef LiveSupport_Widgets_RadioButtons_h +#define LiveSupport_Widgets_RadioButtons_h + +#ifndef __cplusplus +#error This is a C++ include file +#endif + + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#include +#include +#include + +#include "LiveSupport/Core/Ptr.h" + + +namespace LiveSupport { +namespace Widgets { + +using namespace LiveSupport::Core; + +/* ================================================================ constants */ + + +/* =================================================================== macros */ + + +/* =============================================================== data types */ + +/** + * A group of radio buttons. + * + * @author $Author: fgerlits $ + * @version $Revision$ + */ +class RadioButtons : public Gtk::VBox +{ + private: + /** + * The list of radio buttons contained in the widget. + */ + std::vector buttons; + + + public: + /** + * Default constructor. + */ + RadioButtons(void) throw () + { + } + + /** + * A virtual destructor. + */ + virtual + ~RadioButtons(void) throw () + { + } + + /** + * Add a new radio button. + * + * @param label the label of the new button. + */ + void + add(Ptr::Ref label) throw (); + + /** + * Return the number of the active (selected) button. + * The buttons are numbered in the order they were added, starting + * with 0. + * It returns -1 if no radio buttons have been added, and returns + * the number of radio buttons if none of them is active [this + * should never happen]. + * + * @return the number of the active button. + */ + int + getActiveButton(void) const throw (); + +}; + + +/* ================================================= external data structures */ + + +/* ====================================================== function prototypes */ + + +} // namespace Widgets +} // namespace LiveSupport + +#endif // LiveSupport_Widgets_RadioButtons_h + diff --git a/livesupport/src/modules/widgets/src/RadioButtons.cxx b/livesupport/src/modules/widgets/src/RadioButtons.cxx new file mode 100644 index 000000000..20293f160 --- /dev/null +++ b/livesupport/src/modules/widgets/src/RadioButtons.cxx @@ -0,0 +1,90 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: fgerlits $ + Version : $Revision$ + Location : $URL: svn+ssh://fgerlits@code.campware.org/home/svn/repo/livesupport/trunk/livesupport/src/modules/widgets/src/RadioButtons.cxx $ + +------------------------------------------------------------------------------*/ + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#include "LiveSupport/Widgets/RadioButtons.h" + + +using namespace LiveSupport::Core; +using namespace LiveSupport::Widgets; + +/* =================================================== local data structures */ + + +/* ================================================ local constants & macros */ + + +/* =============================================== local function prototypes */ + + +/* ============================================================= module code */ + +/*------------------------------------------------------------------------------ + * Add a new radio button. + *----------------------------------------------------------------------------*/ +void +RadioButtons :: add(Ptr::Ref label) throw () +{ + Gtk::RadioButton * button; + + if (buttons.size() == 0) { + button = Gtk::manage(new Gtk::RadioButton(*label)); + } else { + Gtk::RadioButton * firstButton = buttons.front(); + Gtk::RadioButton::Group group = firstButton->get_group(); + button = Gtk::manage(new Gtk::RadioButton(group, *label)); + } + + buttons.push_back(button); + pack_start(*button, Gtk::PACK_SHRINK, 5); +} + + +/*------------------------------------------------------------------------------ + * Return the number of the active (selected) button. + *----------------------------------------------------------------------------*/ +int +RadioButtons :: getActiveButton(void) const throw () +{ + int i = -1; + + for (i = 0; i < int(buttons.size()); ++i) { + if (buttons[i]->get_active()) { + break; + } + } + + return i; +} + diff --git a/livesupport/src/products/gLiveSupport/etc/Makefile.in b/livesupport/src/products/gLiveSupport/etc/Makefile.in index 8b8631af1..0bb70ebd4 100644 --- a/livesupport/src/products/gLiveSupport/etc/Makefile.in +++ b/livesupport/src/products/gLiveSupport/etc/Makefile.in @@ -263,7 +263,8 @@ G_LIVESUPPORT_OBJS = ${TMP_DIR}/GLiveSupport.o \ ${TMP_DIR}/KeyboardShortcutList.o \ ${TMP_DIR}/OptionsWindow.o \ ${TMP_DIR}/BackupList.o \ - ${TMP_DIR}/BackupView.o + ${TMP_DIR}/BackupView.o \ + ${TMP_DIR}/ExportPlaylistWindow.o G_LIVESUPPORT_RES = ${TMP_DIR}/${PACKAGE_NAME}_root.res \ ${TMP_DIR}/${PACKAGE_NAME}_en.res \ diff --git a/livesupport/src/products/gLiveSupport/src/ExportPlaylistWindow.cxx b/livesupport/src/products/gLiveSupport/src/ExportPlaylistWindow.cxx new file mode 100644 index 000000000..25d486d66 --- /dev/null +++ b/livesupport/src/products/gLiveSupport/src/ExportPlaylistWindow.cxx @@ -0,0 +1,140 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: fgerlits $ + Version : $Revision$ + Location : $URL: svn+ssh://fgerlits@code.campware.org/home/svn/repo/livesupport/trunk/livesupport/src/products/gLiveSupport/src/ExportPlaylistWindow.cxx $ + +------------------------------------------------------------------------------*/ + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#include "LiveSupport/Widgets/WidgetFactory.h" +#include "LiveSupport/Widgets/RadioButtons.h" + +#include "ExportPlaylistWindow.h" + + +using namespace Glib; + +using namespace LiveSupport::Core; +using namespace LiveSupport::Widgets; +using namespace LiveSupport::GLiveSupport; + +/* =================================================== local data structures */ + + +/* ================================================ local constants & macros */ + +namespace { + +/*------------------------------------------------------------------------------ + * The name of the window, used by the keyboard shortcuts (or by the .gtkrc). + *----------------------------------------------------------------------------*/ +const Glib::ustring windowName = "exportPlaylistWindow"; + +} + +/* =============================================== local function prototypes */ + + +/* ============================================================= module code */ + +/*------------------------------------------------------------------------------ + * Constructor. + *----------------------------------------------------------------------------*/ +ExportPlaylistWindow :: ExportPlaylistWindow ( + Ptr::Ref gLiveSupport, + Ptr::Ref bundle, + Ptr::Ref playlist) + throw () + : GuiWindow(gLiveSupport, + bundle, + "") +{ + Ptr::Ref wf = WidgetFactory::getInstance(); + + Gtk::Label * playlistTitleLabel; + Gtk::Label * formatLabel; + Button * cancelButton; + Button * saveButton; + try { + set_title(*getResourceUstring("windowTitle")); + playlistTitleLabel = Gtk::manage(new Gtk::Label( + *getResourceUstring("playlistTitleLabel"))); + formatLabel = Gtk::manage(new Gtk::Label( + *getResourceUstring("formatLabel"))); + cancelButton = Gtk::manage(wf->createButton( + *getResourceUstring("cancelButtonLabel"))); + saveButton = Gtk::manage(wf->createButton( + *getResourceUstring("saveButtonLabel"))); + } catch (std::invalid_argument &e) { + std::cerr << e.what() << std::endl; + std::exit(1); + } + + Gtk::Box * playlistTitleBox = Gtk::manage(new Gtk::HBox); + Gtk::Label * playlistTitle = Gtk::manage(new Gtk::Label( + *playlist->getTitle() )); + playlistTitleBox->pack_start(*playlistTitleLabel, Gtk::PACK_SHRINK, 5); + playlistTitleBox->pack_start(*playlistTitle, Gtk::PACK_SHRINK, 5); + + RadioButtons * formatButtons = Gtk::manage(new RadioButtons); + try { + formatButtons->add(getResourceUstring("internalFormatName")); + formatButtons->add(getResourceUstring("smilFormatName")); + } catch (std::invalid_argument &e) { + std::cerr << e.what() << std::endl; + std::exit(1); + } + + Gtk::Box * formatBox = Gtk::manage(new Gtk::HBox); + formatBox->pack_start(*formatLabel, Gtk::PACK_SHRINK, 5); + formatBox->pack_start(*formatButtons, Gtk::PACK_SHRINK, 5); + + Gtk::Box * buttonBox = Gtk::manage(new Gtk::HButtonBox( + Gtk::BUTTONBOX_END, 5)); + buttonBox->pack_start(*cancelButton); + buttonBox->pack_start(*saveButton); + + Gtk::Box * extraSpace = Gtk::manage(new Gtk::HBox); + 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(*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); + + add(*layout); + + set_name(windowName); + set_default_size(200, 200); + show_all(); +} + diff --git a/livesupport/src/products/gLiveSupport/src/ExportPlaylistWindow.h b/livesupport/src/products/gLiveSupport/src/ExportPlaylistWindow.h new file mode 100644 index 000000000..a23ffdf94 --- /dev/null +++ b/livesupport/src/products/gLiveSupport/src/ExportPlaylistWindow.h @@ -0,0 +1,106 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: fgerlits $ + Version : $Revision$ + Location : $URL: svn+ssh://fgerlits@code.campware.org/home/svn/repo/livesupport/trunk/livesupport/src/products/gLiveSupport/src/ExportPlaylistWindow.h $ + +------------------------------------------------------------------------------*/ +#ifndef ExportPlaylistWindow_h +#define ExportPlaylistWindow_h + +#ifndef __cplusplus +#error This is a C++ include file +#endif + + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#include "LiveSupport/Core/Playlist.h" + +#include "GuiWindow.h" + +namespace LiveSupport { +namespace GLiveSupport { + +using namespace LiveSupport::Core; +using namespace LiveSupport::Widgets; + +/* ================================================================ constants */ + + +/* =================================================================== macros */ + + +/* =============================================================== data types */ + +/** + * The ExportPlaylist window. This is a pop-up window accessible from the + * right-click menus of the Scratchpad, Live Mode and Search/Browse windows. + * It lets the user select the format of the exported playlist, and the + * location where it will be saved. + * + * @author $Author: fgerlits $ + * @version $Revision$ + */ +class ExportPlaylistWindow : public GuiWindow +{ + public: + /** + * Constructor. + * + * @param gLiveSupport the gLiveSupport object, containing + * all the vital info. + * @param bundle the resource bundle holding the localized + * resources for this window. + * @param playlist the playlist to be exported. + */ + ExportPlaylistWindow(Ptr::Ref gLiveSupport, + Ptr::Ref bundle, + Ptr::Ref playlist) + throw (); + + /** + * Virtual destructor. + */ + virtual + ~ExportPlaylistWindow(void) throw () + { + } +}; + +/* ================================================= external data structures */ + + +/* ====================================================== function prototypes */ + + +} // namespace GLiveSupport +} // namespace LiveSupport + +#endif // ExportPlaylistWindow_h +