more RDS stuff (part of #722)
This commit is contained in:
parent
4183f8921f
commit
2046cb8b2b
|
@ -232,29 +232,44 @@ class OptionsContainer
|
|||
throw (std::invalid_argument);
|
||||
|
||||
/**
|
||||
* Set the value of an RDS string.
|
||||
* Set the value of the RDS options.
|
||||
* The key can be any of the RDS data codes, like PS, PI, PTY, RT,
|
||||
* etc. If there is already a value set for this code, it gets
|
||||
* overwritten, otherwise a new key-value pair is added.
|
||||
*
|
||||
* @param key which setting to modify
|
||||
* @param value the new value of the RDS setting
|
||||
* @param key which setting to modify
|
||||
* @param value the new value of the RDS setting
|
||||
* @param enabled the new enabled/disabled state of the
|
||||
* RDS setting
|
||||
*/
|
||||
void
|
||||
setRdsString(Ptr<const Glib::ustring>::Ref key,
|
||||
Ptr<const Glib::ustring>::Ref value) throw ();
|
||||
setRdsOptions(Ptr<const Glib::ustring>::Ref key,
|
||||
Ptr<const Glib::ustring>::Ref value,
|
||||
bool enabled) throw ();
|
||||
|
||||
/**
|
||||
* Get the value of an RDS string.
|
||||
* The key can be any of the RDS data codes, like PS, PI, PTY, RT,
|
||||
* etc. If there is no value set for this code, a zero pointer is
|
||||
* returned.
|
||||
* etc.
|
||||
*
|
||||
* @param key which setting to modify
|
||||
* @return the value of the RDS setting, or a 0 pointer
|
||||
* @return the value of the RDS setting
|
||||
* @exception std::invalid_argument if there is no such RDS option.
|
||||
*/
|
||||
Ptr<const Glib::ustring>::Ref
|
||||
getRdsString(Ptr<const Glib::ustring>::Ref key) throw ();
|
||||
getRdsValue(Ptr<const Glib::ustring>::Ref key)
|
||||
throw (std::invalid_argument);
|
||||
|
||||
/**
|
||||
* Get the enabled/disabled state of an RDS option.
|
||||
*
|
||||
* @param key which setting to modify
|
||||
* @return true if the RDS option is enabled, false otherwise.
|
||||
* @exception std::invalid_argument if there is no such RDS option.
|
||||
*/
|
||||
bool
|
||||
getRdsEnabled(Ptr<const Glib::ustring>::Ref key)
|
||||
throw (std::invalid_argument);
|
||||
|
||||
/**
|
||||
* Save the options to a file.
|
||||
|
|
|
@ -164,7 +164,7 @@ class RdsContainer : public Configurable
|
|||
throw (std::invalid_argument);
|
||||
|
||||
/**
|
||||
* Set the value of an RDS string.
|
||||
* Set the value of the RDS options.
|
||||
* The key can be any of the RDS data codes, like PS, PI, PTY, RT,
|
||||
* etc. If there is already a value set for this code, it gets
|
||||
* overwritten, otherwise a new key-value pair is added.
|
||||
|
@ -173,20 +173,33 @@ class RdsContainer : public Configurable
|
|||
* @param value the new value of the RDS setting.
|
||||
*/
|
||||
void
|
||||
setRdsString(Ptr<const Glib::ustring>::Ref key,
|
||||
Ptr<const Glib::ustring>::Ref value) throw ();
|
||||
setRdsOptions(Ptr<const Glib::ustring>::Ref key,
|
||||
Ptr<const Glib::ustring>::Ref value,
|
||||
bool enabled) throw ();
|
||||
|
||||
/**
|
||||
* Get the value of an RDS string.
|
||||
* The key can be any of the RDS data codes, like PS, PI, PTY, RT,
|
||||
* etc. If there is no value set for this code, a zero pointer is
|
||||
* returned.
|
||||
* etc.
|
||||
*
|
||||
* @param key which setting to modify.
|
||||
* @return the value of the RDS setting, or a 0 pointer.
|
||||
* @return the value of the RDS setting.
|
||||
* @exception std::invalid_argument if there is no such RDS option.
|
||||
*/
|
||||
Ptr<const Glib::ustring>::Ref
|
||||
getRdsString(Ptr<const Glib::ustring>::Ref key) throw ();
|
||||
getRdsValue(Ptr<const Glib::ustring>::Ref key)
|
||||
throw (std::invalid_argument);
|
||||
|
||||
/**
|
||||
* Get the enabled/disabled state of an RDS option.
|
||||
*
|
||||
* @param key which setting to modify.
|
||||
* @return true if the RDS option is enabled, false otherwise.
|
||||
* @exception std::invalid_argument if there is no such RDS option.
|
||||
*/
|
||||
bool
|
||||
getRdsEnabled(Ptr<const Glib::ustring>::Ref key)
|
||||
throw (std::invalid_argument);
|
||||
|
||||
/**
|
||||
* Convert the object to XML.
|
||||
|
|
|
@ -224,7 +224,7 @@ class RdsItem : public Configurable
|
|||
* @return true if the RDS item is enabled, false if not.
|
||||
*/
|
||||
bool
|
||||
isEnabled(void) throw ()
|
||||
getEnabled(void) throw ()
|
||||
{
|
||||
return enabled;
|
||||
}
|
||||
|
|
|
@ -168,15 +168,16 @@ OptionsContainer :: setKeyboardShortcutItem(
|
|||
* Set the value of an RDS string.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
OptionsContainer :: setRdsString(Ptr<const Glib::ustring>::Ref key,
|
||||
Ptr<const Glib::ustring>::Ref value)
|
||||
OptionsContainer :: setRdsOptions(Ptr<const Glib::ustring>::Ref key,
|
||||
Ptr<const Glib::ustring>::Ref value,
|
||||
bool enabled)
|
||||
throw ()
|
||||
{
|
||||
if (!rdsContainer) {
|
||||
rdsContainer.reset(new RdsContainer());
|
||||
}
|
||||
|
||||
rdsContainer->setRdsString(key, value);
|
||||
rdsContainer->setRdsOptions(key, value, enabled);
|
||||
}
|
||||
|
||||
|
||||
|
@ -184,14 +185,29 @@ OptionsContainer :: setRdsString(Ptr<const Glib::ustring>::Ref key,
|
|||
* Get the value of an RDS string.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Ptr<const Glib::ustring>::Ref
|
||||
OptionsContainer :: getRdsString(Ptr<const Glib::ustring>::Ref key)
|
||||
throw ()
|
||||
OptionsContainer :: getRdsValue(Ptr<const Glib::ustring>::Ref key)
|
||||
throw (std::invalid_argument)
|
||||
{
|
||||
Ptr<const Glib::ustring>::Ref value;
|
||||
if (rdsContainer) {
|
||||
value = rdsContainer->getRdsString(key);
|
||||
return rdsContainer->getRdsValue(key);
|
||||
} else {
|
||||
throw std::invalid_argument("no RDS container found");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Get the enabled/disabled state of an RDS option.
|
||||
*----------------------------------------------------------------------------*/
|
||||
bool
|
||||
OptionsContainer :: getRdsEnabled(Ptr<const Glib::ustring>::Ref key)
|
||||
throw (std::invalid_argument)
|
||||
{
|
||||
if (rdsContainer) {
|
||||
return rdsContainer->getRdsEnabled(key);
|
||||
} else {
|
||||
throw std::invalid_argument("no RDS container found");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -85,11 +85,12 @@ RdsContainer :: configure(const xmlpp::Element & element)
|
|||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Set the value of an RDS string.
|
||||
* Set the RDS options.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
RdsContainer :: setRdsString(Ptr<const Glib::ustring>::Ref key,
|
||||
Ptr<const Glib::ustring>::Ref value)
|
||||
RdsContainer :: setRdsOptions(Ptr<const Glib::ustring>::Ref key,
|
||||
Ptr<const Glib::ustring>::Ref value,
|
||||
bool enabled)
|
||||
throw ()
|
||||
{
|
||||
RdsItemListType::const_iterator it;
|
||||
|
@ -100,12 +101,13 @@ RdsContainer :: setRdsString(Ptr<const Glib::ustring>::Ref key,
|
|||
if (*rdsItem->getKey() == *key) {
|
||||
found = true;
|
||||
rdsItem->setValue(value);
|
||||
rdsItem->setEnabled(enabled);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
Ptr<RdsItem>::Ref rdsItem(new RdsItem(key, value));
|
||||
Ptr<RdsItem>::Ref rdsItem(new RdsItem(key, value, enabled));
|
||||
rdsItemList.push_back(rdsItem);
|
||||
}
|
||||
|
||||
|
@ -117,8 +119,8 @@ RdsContainer :: setRdsString(Ptr<const Glib::ustring>::Ref key,
|
|||
* Get the value of an RDS string.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Ptr<const Glib::ustring>::Ref
|
||||
RdsContainer :: getRdsString(Ptr<const Glib::ustring>::Ref key)
|
||||
throw ()
|
||||
RdsContainer :: getRdsValue(Ptr<const Glib::ustring>::Ref key)
|
||||
throw (std::invalid_argument)
|
||||
{
|
||||
RdsItemListType::const_iterator it;
|
||||
for(it = rdsItemList.begin(); it != rdsItemList.end(); ++it) {
|
||||
|
@ -128,8 +130,28 @@ RdsContainer :: getRdsString(Ptr<const Glib::ustring>::Ref key)
|
|||
}
|
||||
}
|
||||
|
||||
Ptr<const Glib::ustring>::Ref nullPointer;
|
||||
return nullPointer;
|
||||
Glib::ustring safeKey = key ? *key : "(null)";
|
||||
throw std::invalid_argument("RDS option " + safeKey + "not found.");
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Get the enabled/disabled state of an RDS option.
|
||||
*----------------------------------------------------------------------------*/
|
||||
bool
|
||||
RdsContainer :: getRdsEnabled(Ptr<const Glib::ustring>::Ref key)
|
||||
throw (std::invalid_argument)
|
||||
{
|
||||
RdsItemListType::const_iterator it;
|
||||
for(it = rdsItemList.begin(); it != rdsItemList.end(); ++it) {
|
||||
Ptr<RdsItem>::Ref rdsItem = *it;
|
||||
if (*rdsItem->getKey() == *key) {
|
||||
return rdsItem->getEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
Glib::ustring safeKey = key ? *key : "(null)";
|
||||
throw std::invalid_argument("RDS option " + safeKey + "not found.");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -124,8 +124,12 @@ RdsContainerTest :: firstTest(void)
|
|||
throw (CPPUNIT_NS::Exception)
|
||||
{
|
||||
Ptr<const Glib::ustring>::Ref key(new const Glib::ustring("PS"));
|
||||
Ptr<const Glib::ustring>::Ref value = rdsContainer->getRdsString(key);
|
||||
|
||||
Ptr<const Glib::ustring>::Ref value = rdsContainer->getRdsValue(key);
|
||||
CPPUNIT_ASSERT(value);
|
||||
CPPUNIT_ASSERT(*value == "BBC Four");
|
||||
|
||||
bool enabled = rdsContainer->getRdsEnabled(key);
|
||||
CPPUNIT_ASSERT(enabled);
|
||||
}
|
||||
|
||||
|
|
|
@ -279,7 +279,9 @@ G_LIVESUPPORT_OBJS = ${TMP_DIR}/GLiveSupport.o \
|
|||
${TMP_DIR}/ExportFormatRadioButtons.o \
|
||||
${TMP_DIR}/TransportList.o \
|
||||
${TMP_DIR}/RestoreBackupWindow.o \
|
||||
${TMP_DIR}/TaskbarIcons.o
|
||||
${TMP_DIR}/TaskbarIcons.o \
|
||||
${TMP_DIR}/RdsView.o \
|
||||
${TMP_DIR}/RdsEntry.o
|
||||
|
||||
G_LIVESUPPORT_RES = ${TMP_DIR}/${RESOURCE_BUNDLE_NAME}_root.res \
|
||||
${TMP_DIR}/${RESOURCE_BUNDLE_NAME}_en.res \
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "LiveSupport/Widgets/Button.h"
|
||||
#include "LiveSupport/Widgets/ScrolledNotebook.h"
|
||||
#include "LiveSupport/Widgets/EntryBin.h"
|
||||
#include "RdsView.h"
|
||||
|
||||
#include "OptionsWindow.h"
|
||||
|
||||
|
@ -102,6 +103,7 @@ OptionsWindow :: OptionsWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
|||
if (canBackup) {
|
||||
backupSectionBox = constructBackupSection();
|
||||
}
|
||||
Gtk::Box * rdsSectionBox = constructRdsSection();
|
||||
Gtk::Box * aboutSectionBox = constructAboutSection();
|
||||
|
||||
try {
|
||||
|
@ -117,6 +119,8 @@ OptionsWindow :: OptionsWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
|||
mainNotebook->appendPage(*backupSectionBox,
|
||||
*getResourceUstring("backupSectionLabel"));
|
||||
}
|
||||
mainNotebook->appendPage(*rdsSectionBox,
|
||||
*getResourceUstring("rdsSectionLabel"));
|
||||
mainNotebook->appendPage(*aboutSectionBox,
|
||||
*getResourceUstring("aboutSectionLabel"));
|
||||
|
||||
|
@ -799,6 +803,27 @@ OptionsWindow :: constructBackupSection(void) throw ()
|
|||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Construct the "RDS" section.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Gtk::VBox*
|
||||
OptionsWindow :: constructRdsSection(void) throw ()
|
||||
{
|
||||
Ptr<ResourceBundle>::Ref rdsBundle;
|
||||
try {
|
||||
rdsBundle = gLiveSupport->getBundle("rdsView");
|
||||
|
||||
} catch (std::invalid_argument &e) {
|
||||
// TODO: signal error
|
||||
std::cerr << e.what() << std::endl;
|
||||
std::exit(1);
|
||||
}
|
||||
|
||||
Gtk::VBox * rdsView = Gtk::manage(new RdsView(gLiveSupport, rdsBundle));
|
||||
return rdsView;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Construct the "About" section.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
|
|
@ -242,6 +242,14 @@ class OptionsWindow : public GuiWindow
|
|||
Gtk::VBox*
|
||||
constructBackupSection(void) throw ();
|
||||
|
||||
/**
|
||||
* Construct the "RDS" section.
|
||||
*
|
||||
* @return a pointer to the new box (already Gtk::manage()'ed)
|
||||
*/
|
||||
Gtk::VBox*
|
||||
constructRdsSection(void) throw ();
|
||||
|
||||
/**
|
||||
* Construct the "About" section.
|
||||
*
|
||||
|
|
|
@ -0,0 +1,127 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author$
|
||||
Version : $Revision$
|
||||
Location : $URL$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include "LiveSupport/Widgets/WidgetFactory.h"
|
||||
|
||||
#include "RdsEntry.h"
|
||||
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
using namespace LiveSupport::Widgets;
|
||||
using namespace LiveSupport::GLiveSupport;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
||||
|
||||
/* ================================================ local constants & macros */
|
||||
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
|
||||
/* ============================================================= module code */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Constructor.
|
||||
*----------------------------------------------------------------------------*/
|
||||
RdsEntry :: RdsEntry(Ptr<ResourceBundle>::Ref bundle,
|
||||
const Glib::ustring & type,
|
||||
int width)
|
||||
throw ()
|
||||
: LocalizedObject(bundle)
|
||||
{
|
||||
this->type.reset(new const Glib::ustring(type));
|
||||
|
||||
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
|
||||
|
||||
checkBox = Gtk::manage(new Gtk::CheckButton());
|
||||
|
||||
Gtk::Label * label;
|
||||
Glib::ustring labelKey = type + "rdsLabel";
|
||||
try {
|
||||
label = Gtk::manage(new Gtk::Label(*getResourceUstring(labelKey)));
|
||||
|
||||
} catch (std::invalid_argument &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
std::exit(1);
|
||||
}
|
||||
|
||||
entryBin = Gtk::manage(wf->createEntryBin());
|
||||
// entryBin->? // set the size somehow
|
||||
|
||||
pack_start(*checkBox, Gtk::PACK_SHRINK, 5);
|
||||
pack_start(*label, Gtk::PACK_SHRINK, 5);
|
||||
pack_start(*entryBin, Gtk::PACK_EXPAND_WIDGET, 5);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Set the state of the widget.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
RdsEntry :: setValue(bool enabled,
|
||||
Ptr<const Glib::ustring>::Ref value) throw ()
|
||||
{
|
||||
checkBox->set_active(enabled);
|
||||
entryBin->set_text(*value);
|
||||
|
||||
checkBoxSaved = enabled;
|
||||
entryBinSaved = value;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Save the changes made by the user.
|
||||
*----------------------------------------------------------------------------*/
|
||||
bool
|
||||
RdsEntry :: saveChanges(Ptr<GLiveSupport>::Ref gLiveSupport) throw ()
|
||||
{
|
||||
bool checkBoxNow = checkBox->get_active();
|
||||
Ptr<const Glib::ustring>::Ref
|
||||
entryBinNow(new const Glib::ustring(entryBin->get_text()));
|
||||
|
||||
if (!entryBinSaved || checkBoxNow != checkBoxSaved
|
||||
|| entryBinNow != entryBinSaved) {
|
||||
Ptr<OptionsContainer>::Ref optionsContainer =
|
||||
gLiveSupport->getOptionsContainer();
|
||||
optionsContainer->setRdsOptions(type, entryBinNow, checkBoxNow);
|
||||
checkBoxSaved = checkBoxNow;
|
||||
entryBinSaved = entryBinNow;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,160 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author$
|
||||
Version : $Revision$
|
||||
Location : $URL$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef RdsEntry_h
|
||||
#define RdsEntry_h
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This is a C++ include file
|
||||
#endif
|
||||
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <gtkmm/box.h>
|
||||
#include <gtkmm/checkbutton.h>
|
||||
|
||||
#include "LiveSupport/Core/Ptr.h"
|
||||
#include "LiveSupport/Core/LocalizedObject.h"
|
||||
#include "LiveSupport/Widgets/EntryBin.h"
|
||||
#include "GLiveSupport.h"
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace GLiveSupport {
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
using namespace LiveSupport::Widgets;
|
||||
using namespace LiveSupport::GLiveSupport;
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
||||
/* =================================================================== macros */
|
||||
|
||||
|
||||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* A single RDS input field.
|
||||
*
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
class RdsEntry : public Gtk::HBox,
|
||||
public LocalizedObject
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* The RDS type of the object (PS, PI, RT, etc).
|
||||
*/
|
||||
Ptr<const Glib::ustring>::Ref type;
|
||||
|
||||
/**
|
||||
* The saved state of the checkbox.
|
||||
*/
|
||||
bool checkBoxSaved;
|
||||
|
||||
/**
|
||||
* The saved contents of the entry bin.
|
||||
*/
|
||||
Ptr<const Glib::ustring>::Ref entryBinSaved;
|
||||
|
||||
|
||||
protected:
|
||||
/**
|
||||
* The enable/disable checkbox.
|
||||
*/
|
||||
Gtk::CheckButton * checkBox;
|
||||
|
||||
/**
|
||||
* The entry field.
|
||||
*/
|
||||
EntryBin * entryBin;
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor.
|
||||
* The type parameter is a string of 2 or 3 upper-case characters,
|
||||
* see http://en.wikipedia.org/wiki/Radio_Data_System.
|
||||
*
|
||||
* @param bundle the resource bundle holding the localized
|
||||
* resources for this window.
|
||||
* @param type the type of RDS data (PS, PI, RT, etc).
|
||||
* @param width the width of the entry, in characters.
|
||||
*/
|
||||
RdsEntry(Ptr<ResourceBundle>::Ref bundle,
|
||||
const Glib::ustring & type,
|
||||
int width) throw ();
|
||||
|
||||
/**
|
||||
* A virtual destructor.
|
||||
*/
|
||||
virtual
|
||||
~RdsEntry(void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the state of the widget.
|
||||
*
|
||||
* @param enabled the new state of the checkBox.
|
||||
* @param value the new contents of the entryBin.
|
||||
*/
|
||||
void
|
||||
setValue(bool enabled,
|
||||
Ptr<const Glib::ustring>::Ref value) throw ();
|
||||
|
||||
/**
|
||||
* Save the changes made by the user.
|
||||
*
|
||||
* @param gLiveSupport the GLiveSupport object holding the
|
||||
* RDS options to be modified.
|
||||
* @return true if any changes were saved; false otherwise.
|
||||
*/
|
||||
bool
|
||||
saveChanges(Ptr<GLiveSupport>::Ref gLiveSupport) throw ();
|
||||
};
|
||||
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
||||
|
||||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace GLiveSupport
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // LiveSupport_GLiveSupport_RdsEntry_h
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author$
|
||||
Version : $Revision$
|
||||
Location : $URL$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include "RdsView.h"
|
||||
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
using namespace LiveSupport::Widgets;
|
||||
using namespace LiveSupport::GLiveSupport;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
||||
|
||||
/* ================================================ local constants & macros */
|
||||
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
|
||||
/* ============================================================= module code */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Constructor.
|
||||
*----------------------------------------------------------------------------*/
|
||||
RdsView :: RdsView (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||
Ptr<ResourceBundle>::Ref bundle)
|
||||
throw ()
|
||||
: LocalizedObject(bundle),
|
||||
gLiveSupport(gLiveSupport)
|
||||
{
|
||||
Ptr<RdsEntry>::Ref psEntry(new RdsEntry(getBundle(), "PS", 8));
|
||||
Ptr<RdsEntry>::Ref piEntry(new RdsEntry(getBundle(), "PI", 4));
|
||||
Ptr<RdsEntry>::Ref rtEntry(new RdsEntry(getBundle(), "RT", 32));
|
||||
|
||||
rdsEntryList.push_back(psEntry);
|
||||
rdsEntryList.push_back(piEntry);
|
||||
rdsEntryList.push_back(rtEntry);
|
||||
|
||||
pack_start(*psEntry, Gtk::PACK_SHRINK, 10);
|
||||
pack_start(*piEntry, Gtk::PACK_SHRINK, 0);
|
||||
pack_start(*rtEntry, Gtk::PACK_SHRINK, 10);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Save the changes made by the user.
|
||||
*----------------------------------------------------------------------------*/
|
||||
bool
|
||||
RdsView :: saveChanges(void) throw ()
|
||||
{
|
||||
bool touched = false;
|
||||
|
||||
RdsEntryListType::const_iterator it;
|
||||
for (it = rdsEntryList.begin(); it != rdsEntryList.end(); ++it) {
|
||||
Ptr<RdsEntry>::Ref rdsEntry = *it;
|
||||
touched |= rdsEntry->saveChanges(gLiveSupport);
|
||||
}
|
||||
|
||||
return touched;
|
||||
}
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author$
|
||||
Version : $Revision$
|
||||
Location : $URL$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef RdsView_h
|
||||
#define RdsView_h
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This is a C++ include file
|
||||
#endif
|
||||
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <gtkmm/box.h>
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
|
||||
#include "LiveSupport/Core/Ptr.h"
|
||||
#include "LiveSupport/Core/LocalizedObject.h"
|
||||
#include "LiveSupport/Widgets/Button.h"
|
||||
#include "LiveSupport/Widgets/ScrolledWindow.h"
|
||||
#include "RdsEntry.h"
|
||||
#include "GLiveSupport.h"
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace GLiveSupport {
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
using namespace LiveSupport::Widgets;
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
||||
/* =================================================================== macros */
|
||||
|
||||
|
||||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* The RDS view, a subclass of Gtk::VBox.
|
||||
* This will be contained in another window, most likely
|
||||
* as the contents of a notebook tab.
|
||||
*
|
||||
* The layout of the view is roughly the following:
|
||||
* <pre><code>
|
||||
* +--- RDS view -----------------------------------+
|
||||
* | ___________ |
|
||||
* | [x] Station name: |___________| |
|
||||
* | ________ |
|
||||
* | [x] Station ID: |________| |
|
||||
* | ___________________________ |
|
||||
* | [ ] Clip info: |___________________________| |
|
||||
* | |
|
||||
* +------------------------------------------------+
|
||||
* </code></pre>
|
||||
* where each item has a checkbox [x] with which one can enable or disable it.
|
||||
*
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
class RdsView : public Gtk::VBox,
|
||||
public LocalizedObject
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* The type for the list of entry widgets.
|
||||
*/
|
||||
typedef std::vector<Ptr<RdsEntry>::Ref> RdsEntryListType;
|
||||
|
||||
/**
|
||||
* The list of the entry widgets.
|
||||
*/
|
||||
RdsEntryListType rdsEntryList;
|
||||
|
||||
|
||||
protected:
|
||||
/**
|
||||
* The GLiveSupport object, holding the state of the application.
|
||||
*/
|
||||
Ptr<GLiveSupport>::Ref gLiveSupport;
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param gLiveSupport the gLiveSupport object, containing
|
||||
* all the vital info.
|
||||
* @param bundle the resource bundle holding the localized
|
||||
* resources for this window.
|
||||
*/
|
||||
RdsView(Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||
Ptr<ResourceBundle>::Ref bundle)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Virtual destructor.
|
||||
*/
|
||||
virtual
|
||||
~RdsView(void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the changes made by the user.
|
||||
*
|
||||
* @return true if any changes were saved; false otherwise.
|
||||
*/
|
||||
bool
|
||||
saveChanges(void) throw ();
|
||||
};
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
||||
|
||||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace GLiveSupport
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // RdsView_h
|
||||
|
|
@ -276,6 +276,7 @@ root:table
|
|||
serversSectionLabel:string { "Servers" }
|
||||
schedulerSectionLabel:string { "Scheduler" }
|
||||
backupSectionLabel:string { "Backup" }
|
||||
rdsSectionLabel:string { "RDS" }
|
||||
aboutSectionLabel:string { "About" }
|
||||
|
||||
cancelButtonLabel:string { "Cancel" }
|
||||
|
@ -352,6 +353,13 @@ root:table
|
|||
backupErrorMsg:string { "Backup error: " }
|
||||
}
|
||||
|
||||
rdsView:table
|
||||
{
|
||||
PSrdsLabel:string { "Station name:" }
|
||||
PIrdsLabel:string { "Station code:" }
|
||||
RTrdsLabel:string { "Clip info:" }
|
||||
}
|
||||
|
||||
dateTimeChooserWindow:table
|
||||
{
|
||||
windowTitle:string { "Select the date and time" }
|
||||
|
|
Loading…
Reference in New Issue