first version of playlist export (does not do anything yet)
This commit is contained in:
parent
676a7dd080
commit
255cb4ba06
15 changed files with 832 additions and 4 deletions
|
@ -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<Glib::ustring>::Ref
|
||||
exportPlaylistOpen(Ptr<SessionId>::Ref sessionId,
|
||||
Ptr<UniqueId>::Ref playlistId,
|
||||
ExportFormatType format,
|
||||
Ptr<Glib::ustring>::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<const Glib::ustring>::Ref token) const
|
||||
throw (XmlRpcException)
|
||||
= 0;
|
||||
|
||||
/**
|
||||
* A virtual destructor, as this class has virtual functions.
|
||||
*/
|
||||
|
|
|
@ -1026,3 +1026,30 @@ TestStorageClient :: createBackupClose(const Glib::ustring & token) const
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Initiate the exporting of a playlist.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Ptr<Glib::ustring>::Ref
|
||||
TestStorageClient :: exportPlaylistOpen(Ptr<SessionId>::Ref sessionId,
|
||||
Ptr<UniqueId>::Ref playlistId,
|
||||
ExportFormatType format,
|
||||
Ptr<Glib::ustring>::Ref url) const
|
||||
throw (XmlRpcException)
|
||||
{
|
||||
url->assign("http://some/fake/url");
|
||||
Ptr<Glib::ustring>::Ref token(new Glib::ustring("fake token"));
|
||||
return token;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Close the playlist export process.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
TestStorageClient :: exportPlaylistClose(
|
||||
Ptr<const Glib::ustring>::Ref token) const
|
||||
throw (XmlRpcException)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Glib::ustring>::Ref
|
||||
exportPlaylistOpen(Ptr<SessionId>::Ref sessionId,
|
||||
Ptr<UniqueId>::Ref playlistId,
|
||||
ExportFormatType format,
|
||||
Ptr<Glib::ustring>::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<const Glib::ustring>::Ref token) const
|
||||
throw (XmlRpcException);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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<UniqueId>::Ref playlistId(new UniqueId(1));
|
||||
Ptr<Glib::ustring>::Ref url(new Glib::ustring(""));
|
||||
Ptr<Glib::ustring>::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);
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<SessionId>::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:
|
||||
|
||||
|
|
|
@ -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<Glib::ustring>::Ref
|
||||
WebStorageClient :: exportPlaylistOpen(Ptr<SessionId>::Ref sessionId,
|
||||
Ptr<UniqueId>::Ref playlistId,
|
||||
ExportFormatType format,
|
||||
Ptr<Glib::ustring>::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<Glib::ustring>::Ref token(new Glib::ustring(
|
||||
result[exportPlaylistTokenParamName] ));
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Close the playlist export process.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
WebStorageClient :: exportPlaylistClose(
|
||||
Ptr<const Glib::ustring>::Ref token) const
|
||||
throw (XmlRpcException)
|
||||
{
|
||||
XmlRpcValue parameters;
|
||||
XmlRpcValue result;
|
||||
|
||||
parameters.clear();
|
||||
parameters[exportPlaylistTokenParamName]
|
||||
= std::string(*token);
|
||||
|
||||
execute(exportPlaylistCloseMethodName, parameters, result);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Glib::ustring>::Ref
|
||||
exportPlaylistOpen(Ptr<SessionId>::Ref sessionId,
|
||||
Ptr<UniqueId>::Ref playlistId,
|
||||
ExportFormatType format,
|
||||
Ptr<Glib::ustring>::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<const Glib::ustring>::Ref token) const
|
||||
throw (XmlRpcException);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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<SessionId>::Ref sessionId;
|
||||
CPPUNIT_ASSERT_NO_THROW(
|
||||
sessionId = authentication->login("root", "q");
|
||||
);
|
||||
CPPUNIT_ASSERT(sessionId);
|
||||
|
||||
Ptr<UniqueId>::Ref playlistId(new UniqueId(1));
|
||||
Ptr<Glib::ustring>::Ref url(new Glib::ustring(""));
|
||||
Ptr<Glib::ustring>::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);
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<WebStorageClient>::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:
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <vector>
|
||||
#include <gtkmm/box.h>
|
||||
#include <gtkmm/radiobutton.h>
|
||||
|
||||
#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<Gtk::RadioButton*> 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<const Glib::ustring>::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
|
||||
|
90
livesupport/src/modules/widgets/src/RadioButtons.cxx
Normal file
90
livesupport/src/modules/widgets/src/RadioButtons.cxx
Normal file
|
@ -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<const Glib::ustring>::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;
|
||||
}
|
||||
|
|
@ -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 \
|
||||
|
|
|
@ -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<GLiveSupport>::Ref gLiveSupport,
|
||||
Ptr<ResourceBundle>::Ref bundle,
|
||||
Ptr<Playlist>::Ref playlist)
|
||||
throw ()
|
||||
: GuiWindow(gLiveSupport,
|
||||
bundle,
|
||||
"")
|
||||
{
|
||||
Ptr<WidgetFactory>::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();
|
||||
}
|
||||
|
106
livesupport/src/products/gLiveSupport/src/ExportPlaylistWindow.h
Normal file
106
livesupport/src/products/gLiveSupport/src/ExportPlaylistWindow.h
Normal file
|
@ -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<GLiveSupport>::Ref gLiveSupport,
|
||||
Ptr<ResourceBundle>::Ref bundle,
|
||||
Ptr<Playlist>::Ref playlist)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Virtual destructor.
|
||||
*/
|
||||
virtual
|
||||
~ExportPlaylistWindow(void) throw ()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
||||
|
||||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace GLiveSupport
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // ExportPlaylistWindow_h
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue