load and save the RDS settings from the config file (part of #722)
This commit is contained in:
parent
2046cb8b2b
commit
6cab754062
|
@ -344,7 +344,7 @@ void
|
|||
OptionsContainer :: writeToFile(void) throw ()
|
||||
{
|
||||
if (configFileName) {
|
||||
if (rdsContainer && rdsContainer->isTouched()) {
|
||||
if (rdsContainer) {
|
||||
xmlpp::Element * rootNode = optionsDocument.get_root_node();
|
||||
xmlpp::Node::NodeList nodes = rootNode->get_children(
|
||||
RdsContainer::getConfigElementName());
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include "LiveSupport/Widgets/Button.h"
|
||||
#include "LiveSupport/Widgets/ScrolledNotebook.h"
|
||||
#include "LiveSupport/Widgets/EntryBin.h"
|
||||
#include "RdsView.h"
|
||||
|
||||
#include "OptionsWindow.h"
|
||||
|
||||
|
@ -196,6 +195,7 @@ OptionsWindow :: onApplyButtonClicked(void) throw ()
|
|||
{
|
||||
bool changed = saveChangesInStringEntryFields();
|
||||
saveChangesInKeyBindings(); // no need to restart
|
||||
saveChangesInRds(); // no need to restart
|
||||
|
||||
if (changed) {
|
||||
try {
|
||||
|
@ -315,6 +315,16 @@ OptionsWindow :: saveChangesInKeyBindings(void) throw ()
|
|||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Save the changes in the RDS settings.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
OptionsWindow :: saveChangesInRds(void) throw ()
|
||||
{
|
||||
rdsView->saveChanges();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Event handler for the OK button.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
@ -819,7 +829,7 @@ OptionsWindow :: constructRdsSection(void) throw ()
|
|||
std::exit(1);
|
||||
}
|
||||
|
||||
Gtk::VBox * rdsView = Gtk::manage(new RdsView(gLiveSupport, rdsBundle));
|
||||
rdsView = Gtk::manage(new RdsView(gLiveSupport, rdsBundle));
|
||||
return rdsView;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
#include "GLiveSupport.h"
|
||||
#include "MasterPanelUserInfoWidget.h"
|
||||
#include "BackupView.h"
|
||||
#include "RdsView.h"
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace GLiveSupport {
|
||||
|
@ -201,6 +202,12 @@ class OptionsWindow : public GuiWindow
|
|||
void
|
||||
saveChangesInKeyBindings(void) throw ();
|
||||
|
||||
/**
|
||||
* Save the changes in the RDS settings.
|
||||
*/
|
||||
void
|
||||
saveChangesInRds(void) throw ();
|
||||
|
||||
/**
|
||||
* Construct the "Sound" section.
|
||||
*
|
||||
|
@ -416,6 +423,11 @@ class OptionsWindow : public GuiWindow
|
|||
*/
|
||||
BackupView * backupView;
|
||||
|
||||
/**
|
||||
* The RdsView shown in the RDS section.
|
||||
*/
|
||||
RdsView * rdsView;
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
|
|
|
@ -91,8 +91,8 @@ RdsEntry :: RdsEntry(Ptr<ResourceBundle>::Ref bundle,
|
|||
* Set the state of the widget.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
RdsEntry :: setValue(bool enabled,
|
||||
Ptr<const Glib::ustring>::Ref value) throw ()
|
||||
RdsEntry :: setOptions(bool enabled,
|
||||
Ptr<const Glib::ustring>::Ref value) throw ()
|
||||
{
|
||||
checkBox->set_active(enabled);
|
||||
entryBin->set_text(*value);
|
||||
|
|
|
@ -125,6 +125,18 @@ class RdsEntry : public Gtk::HBox,
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type of the widget.
|
||||
* Returns the RDS option type (PS, PI, RT, ...).
|
||||
*
|
||||
* @return the "type" parameter passed to the constructor.
|
||||
*/
|
||||
Ptr<const Glib::ustring>::Ref
|
||||
getType(void) throw ()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the state of the widget.
|
||||
*
|
||||
|
@ -132,8 +144,8 @@ class RdsEntry : public Gtk::HBox,
|
|||
* @param value the new contents of the entryBin.
|
||||
*/
|
||||
void
|
||||
setValue(bool enabled,
|
||||
Ptr<const Glib::ustring>::Ref value) throw ();
|
||||
setOptions(bool enabled,
|
||||
Ptr<const Glib::ustring>::Ref value) throw ();
|
||||
|
||||
/**
|
||||
* Save the changes made by the user.
|
||||
|
|
|
@ -71,6 +71,33 @@ RdsView :: RdsView (Ptr<GLiveSupport>::Ref gLiveSupport,
|
|||
pack_start(*psEntry, Gtk::PACK_SHRINK, 10);
|
||||
pack_start(*piEntry, Gtk::PACK_SHRINK, 0);
|
||||
pack_start(*rtEntry, Gtk::PACK_SHRINK, 10);
|
||||
|
||||
RdsEntryListType::const_iterator it;
|
||||
for (it = rdsEntryList.begin(); it != rdsEntryList.end(); ++it) {
|
||||
fillEntry(*it);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Fill in the entry from the OptionsContainer.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
RdsView :: fillEntry(Ptr<RdsEntry>::Ref entry) throw ()
|
||||
{
|
||||
Ptr<OptionsContainer>::Ref options = gLiveSupport->getOptionsContainer();
|
||||
|
||||
if (options) {
|
||||
Ptr<const Glib::ustring>::Ref type = entry->getType();
|
||||
try {
|
||||
bool enabled = options->getRdsEnabled(type);
|
||||
Ptr<const Glib::ustring>::Ref
|
||||
value = options->getRdsValue(type);
|
||||
entry->setOptions(enabled, value);
|
||||
} catch (std::invalid_argument &e) {
|
||||
// there is no such RDS option; it's OK
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -100,6 +100,14 @@ class RdsView : public Gtk::VBox,
|
|||
*/
|
||||
RdsEntryListType rdsEntryList;
|
||||
|
||||
/**
|
||||
* Fill in the entry from the OptionsContainer.
|
||||
*
|
||||
* @param entry the RdsEntry to be filled in.
|
||||
*/
|
||||
void
|
||||
fillEntry(Ptr<RdsEntry>::Ref entry) throw ();
|
||||
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue