added Servers tab;
refactored a bit to reduce the amount of copy-paste code; improved the spacings
This commit is contained in:
parent
7b7bd4bb9b
commit
60e45ea3b1
5 changed files with 337 additions and 109 deletions
|
@ -76,22 +76,8 @@ OptionsContainer :: setOptionItem(OptionItemString optionItem,
|
||||||
Ptr<const Glib::ustring>::Ref value)
|
Ptr<const Glib::ustring>::Ref value)
|
||||||
throw (std::invalid_argument)
|
throw (std::invalid_argument)
|
||||||
{
|
{
|
||||||
xmlpp::Node * targetNode = 0;
|
bool isAttribute = false; // text node or attr node
|
||||||
bool isAttribute = false; // text node or attr node
|
xmlpp::Node * targetNode = selectNode(optionItem, isAttribute);
|
||||||
|
|
||||||
switch (optionItem) {
|
|
||||||
case outputPlayerDeviceName :
|
|
||||||
targetNode = getNode("outputPlayer/audioPlayer/gstreamerPlayer/"
|
|
||||||
"@audioDevice");
|
|
||||||
isAttribute = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case cuePlayerDeviceName :
|
|
||||||
targetNode = getNode("cuePlayer/audioPlayer/gstreamerPlayer/"
|
|
||||||
"@audioDevice");
|
|
||||||
isAttribute = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isAttribute) {
|
if (isAttribute) {
|
||||||
xmlpp::Attribute * attr = dynamic_cast<xmlpp::Attribute*>(targetNode);
|
xmlpp::Attribute * attr = dynamic_cast<xmlpp::Attribute*>(targetNode);
|
||||||
|
@ -120,23 +106,9 @@ Ptr<Glib::ustring>::Ref
|
||||||
OptionsContainer :: getOptionItem(OptionItemString optionItem)
|
OptionsContainer :: getOptionItem(OptionItemString optionItem)
|
||||||
throw (std::invalid_argument)
|
throw (std::invalid_argument)
|
||||||
{
|
{
|
||||||
const xmlpp::Node * targetNode = 0;
|
bool isAttribute = false; // text node or attr node
|
||||||
bool isAttribute = false; // child text node or attr
|
const xmlpp::Node * targetNode = selectNode(optionItem, isAttribute);
|
||||||
|
|
||||||
switch (optionItem) {
|
|
||||||
case outputPlayerDeviceName :
|
|
||||||
targetNode = getNode("outputPlayer/audioPlayer/gstreamerPlayer/"
|
|
||||||
"@audioDevice");
|
|
||||||
isAttribute = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case cuePlayerDeviceName :
|
|
||||||
targetNode = getNode("cuePlayer/audioPlayer/gstreamerPlayer/"
|
|
||||||
"@audioDevice");
|
|
||||||
isAttribute = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isAttribute) {
|
if (isAttribute) {
|
||||||
const xmlpp::Attribute *
|
const xmlpp::Attribute *
|
||||||
attr = dynamic_cast<const xmlpp::Attribute*>(targetNode);
|
attr = dynamic_cast<const xmlpp::Attribute*>(targetNode);
|
||||||
|
@ -159,6 +131,70 @@ OptionsContainer :: getOptionItem(OptionItemString optionItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Find the node corresponding to an OptionItemString value.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
xmlpp::Node *
|
||||||
|
OptionsContainer :: selectNode(OptionItemString optionItem,
|
||||||
|
bool & isAttribute)
|
||||||
|
throw (std::invalid_argument)
|
||||||
|
{
|
||||||
|
xmlpp::Node * targetNode = 0;
|
||||||
|
|
||||||
|
switch (optionItem) {
|
||||||
|
case outputPlayerDeviceName :
|
||||||
|
targetNode = getNode("outputPlayer/audioPlayer/gstreamerPlayer/"
|
||||||
|
"@audioDevice");
|
||||||
|
isAttribute = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case cuePlayerDeviceName :
|
||||||
|
targetNode = getNode("cuePlayer/audioPlayer/gstreamerPlayer/"
|
||||||
|
"@audioDevice");
|
||||||
|
isAttribute = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case authenticationServer :
|
||||||
|
targetNode = getNode("authenticationClientFactory/"
|
||||||
|
"webAuthentication/location/@server");
|
||||||
|
isAttribute = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case authenticationPort :
|
||||||
|
targetNode = getNode("authenticationClientFactory/"
|
||||||
|
"webAuthentication/location/@port");
|
||||||
|
isAttribute = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case authenticationPath :
|
||||||
|
targetNode = getNode("authenticationClientFactory/"
|
||||||
|
"webAuthentication/location/@path");
|
||||||
|
isAttribute = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case storageServer :
|
||||||
|
targetNode = getNode("storageClientFactory/"
|
||||||
|
"webStorage/location/@server");
|
||||||
|
isAttribute = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case storagePort :
|
||||||
|
targetNode = getNode("storageClientFactory/"
|
||||||
|
"webStorage/location/@port");
|
||||||
|
isAttribute = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case storagePath :
|
||||||
|
targetNode = getNode("storageClientFactory/"
|
||||||
|
"webStorage/location/@path");
|
||||||
|
isAttribute = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return targetNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Return the first node matching an XPath string.
|
* Return the first node matching an XPath string.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -68,6 +68,25 @@ using namespace LiveSupport::Core;
|
||||||
*/
|
*/
|
||||||
class OptionsContainer
|
class OptionsContainer
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* The list of string options one can set.
|
||||||
|
*
|
||||||
|
* These are options of type Glib::ustring; any string is accepted
|
||||||
|
* as value, no range checking is done.
|
||||||
|
*
|
||||||
|
* For the moment, this is the only kind of option supported.
|
||||||
|
*/
|
||||||
|
typedef enum { outputPlayerDeviceName,
|
||||||
|
cuePlayerDeviceName,
|
||||||
|
authenticationServer,
|
||||||
|
authenticationPort,
|
||||||
|
authenticationPath,
|
||||||
|
storageServer,
|
||||||
|
storagePort,
|
||||||
|
storagePath } OptionItemString;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* The XML document containing the options.
|
* The XML document containing the options.
|
||||||
|
@ -91,6 +110,24 @@ class OptionsContainer
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the node corresponding to an OptionItemString value.
|
||||||
|
*
|
||||||
|
* If there is no matching node, it returns a 0 pointer.
|
||||||
|
*
|
||||||
|
* @param optionItem the name of the item to find the node for
|
||||||
|
* @param isAttribute return parameter; is set to true if the
|
||||||
|
* node is an attribute, false if it's
|
||||||
|
* a CDATA text
|
||||||
|
* @return a pointer to the node found, or 0
|
||||||
|
* @exception std::invalid_argument thrown by getNode() [should
|
||||||
|
* never happen]
|
||||||
|
*/
|
||||||
|
xmlpp::Node *
|
||||||
|
selectNode(OptionItemString optionItem,
|
||||||
|
bool & isAttribute)
|
||||||
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the first node matching an XPath string.
|
* Return the first node matching an XPath string.
|
||||||
*
|
*
|
||||||
|
@ -98,6 +135,7 @@ class OptionsContainer
|
||||||
*
|
*
|
||||||
* @param xPath the XPath of the node (from the root node)
|
* @param xPath the XPath of the node (from the root node)
|
||||||
* @return a pointer to the node found, or 0
|
* @return a pointer to the node found, or 0
|
||||||
|
* @exception std::invalid_argument if the XPath is not well formed
|
||||||
*/
|
*/
|
||||||
xmlpp::Node *
|
xmlpp::Node *
|
||||||
getNode(const Glib::ustring & xPath)
|
getNode(const Glib::ustring & xPath)
|
||||||
|
@ -131,17 +169,6 @@ class OptionsContainer
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The list of string options one can set.
|
|
||||||
*
|
|
||||||
* These are options of type Glib::ustring; any string is accepted
|
|
||||||
* as value, no range checking is done.
|
|
||||||
*
|
|
||||||
* For the moment, this is the only kind of option supported.
|
|
||||||
*/
|
|
||||||
typedef enum { outputPlayerDeviceName,
|
|
||||||
cuePlayerDeviceName } OptionItemString;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a string type option.
|
* Set a string type option.
|
||||||
*
|
*
|
||||||
|
|
|
@ -88,12 +88,15 @@ OptionsWindow :: OptionsWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
|
|
||||||
// build up the notepad for the various sections
|
// build up the notepad for the various sections
|
||||||
mainNotebook = Gtk::manage(new ScrolledNotebook);
|
mainNotebook = Gtk::manage(new ScrolledNotebook);
|
||||||
Gtk::Box * soundSectionBox = constructSoundSection();
|
Gtk::Box * soundSectionBox = constructSoundSection();
|
||||||
Gtk::Box * aboutSectionBox = constructAboutSection();
|
Gtk::Box * serversSectionBox = constructServersSection();
|
||||||
|
Gtk::Box * aboutSectionBox = constructAboutSection();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mainNotebook->appendPage(*soundSectionBox,
|
mainNotebook->appendPage(*soundSectionBox,
|
||||||
*getResourceUstring("soundSectionLabel"));
|
*getResourceUstring("soundSectionLabel"));
|
||||||
|
mainNotebook->appendPage(*serversSectionBox,
|
||||||
|
*getResourceUstring("serversSectionLabel"));
|
||||||
mainNotebook->appendPage(*aboutSectionBox,
|
mainNotebook->appendPage(*aboutSectionBox,
|
||||||
*getResourceUstring("aboutSectionLabel"));
|
*getResourceUstring("aboutSectionLabel"));
|
||||||
|
|
||||||
|
@ -142,7 +145,7 @@ OptionsWindow :: OptionsWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
|
|
||||||
// show everything
|
// show everything
|
||||||
set_name(windowName);
|
set_name(windowName);
|
||||||
set_default_size(350, 300);
|
set_default_size(500, 400);
|
||||||
set_modal(false);
|
set_modal(false);
|
||||||
property_window_position().set_value(Gtk::WIN_POS_NONE);
|
property_window_position().set_value(Gtk::WIN_POS_NONE);
|
||||||
|
|
||||||
|
@ -169,29 +172,24 @@ OptionsWindow :: onApplyButtonClicked(void) throw ()
|
||||||
Ptr<OptionsContainer>::Ref
|
Ptr<OptionsContainer>::Ref
|
||||||
optionsContainer = gLiveSupport->getOptionsContainer();
|
optionsContainer = gLiveSupport->getOptionsContainer();
|
||||||
|
|
||||||
// check for changes in the Sound tab
|
StringEntryListType::const_iterator it;
|
||||||
Ptr<const Glib::ustring>::Ref
|
for (it = stringEntryList.begin(); it != stringEntryList.end(); ++it) {
|
||||||
oldCueDevice = optionsContainer->getOptionItem(
|
|
||||||
OptionsContainer::cuePlayerDeviceName );
|
|
||||||
Ptr<const Glib::ustring>::Ref
|
|
||||||
newCueDevice(new Glib::ustring(cuePlayerEntry->get_text()));
|
|
||||||
|
|
||||||
if (*oldCueDevice != *newCueDevice) {
|
OptionsContainer::OptionItemString optionItem = it->first;
|
||||||
optionsContainer->setOptionItem(
|
EntryBin * entry = it->second;
|
||||||
OptionsContainer::cuePlayerDeviceName,
|
|
||||||
newCueDevice );
|
Ptr<const Glib::ustring>::Ref
|
||||||
}
|
oldValue = optionsContainer->getOptionItem(optionItem);
|
||||||
|
Ptr<const Glib::ustring>::Ref
|
||||||
Ptr<const Glib::ustring>::Ref
|
newValue(new Glib::ustring(entry->get_text()));
|
||||||
oldOutputDevice = optionsContainer->getOptionItem(
|
|
||||||
OptionsContainer::outputPlayerDeviceName );
|
if (*oldValue != *newValue) {
|
||||||
Ptr<const Glib::ustring>::Ref
|
try {
|
||||||
newOutputDevice(new Glib::ustring(outputPlayerEntry->get_text()));
|
optionsContainer->setOptionItem(optionItem, newValue);
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
if (*oldOutputDevice != *newOutputDevice) {
|
// TODO: signal error
|
||||||
optionsContainer->setOptionItem(
|
}
|
||||||
OptionsContainer::outputPlayerDeviceName,
|
}
|
||||||
newOutputDevice );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,32 +220,29 @@ OptionsWindow :: onCloseButtonClicked(bool needConfirm) throw ()
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Construct the "About" section.
|
* Create a new user entry field item.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
Gtk::VBox*
|
EntryBin *
|
||||||
OptionsWindow :: constructAboutSection(void) throw ()
|
OptionsWindow :: createEntry(OptionsContainer::OptionItemString optionItem)
|
||||||
|
throw ()
|
||||||
{
|
{
|
||||||
Glib::ustring aboutLabelContents;
|
Ptr<OptionsContainer>::Ref optionsContainer
|
||||||
aboutLabelContents.append(PACKAGE_NAME);
|
= gLiveSupport->getOptionsContainer();
|
||||||
aboutLabelContents.append(" ");
|
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
|
||||||
aboutLabelContents.append(PACKAGE_VERSION);
|
|
||||||
aboutLabelContents.append("\n\n");
|
|
||||||
try {
|
|
||||||
aboutLabelContents.append(*formatMessage("reportBugsToText",
|
|
||||||
PACKAGE_BUGREPORT ));
|
|
||||||
} catch (std::invalid_argument &e) {
|
|
||||||
// TODO: signal error
|
|
||||||
std::cerr << e.what() << std::endl;
|
|
||||||
std::exit(1);
|
|
||||||
}
|
|
||||||
Gtk::Label * aboutLabel = Gtk::manage(
|
|
||||||
new Gtk::Label(aboutLabelContents) );
|
|
||||||
|
|
||||||
// make a new box and pack the components into it
|
EntryBin * entry = Gtk::manage(wf->createEntryBin());
|
||||||
Gtk::VBox * section = Gtk::manage(new Gtk::VBox);
|
|
||||||
section->pack_start(*aboutLabel, Gtk::PACK_SHRINK, 5);
|
try {
|
||||||
|
entry->set_text(*optionsContainer->getOptionItem(optionItem));
|
||||||
|
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
// TODO: signal error?
|
||||||
|
entry->set_text("");
|
||||||
|
}
|
||||||
|
|
||||||
return section;
|
stringEntryList.push_back(std::make_pair(optionItem, entry));
|
||||||
|
|
||||||
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -277,11 +272,11 @@ OptionsWindow :: constructSoundSection(void) throw ()
|
||||||
}
|
}
|
||||||
Gtk::Label * cuePlayerLabel = Gtk::manage(
|
Gtk::Label * cuePlayerLabel = Gtk::manage(
|
||||||
new Gtk::Label(cuePlayerLabelContents) );
|
new Gtk::Label(cuePlayerLabelContents) );
|
||||||
audioDeviceTable->attach(*cuePlayerLabel, 0, 1, 0, 1);
|
audioDeviceTable->attach(*cuePlayerLabel,
|
||||||
|
0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 5, 0);
|
||||||
|
|
||||||
cuePlayerEntry = Gtk::manage(wf->createEntryBin());
|
EntryBin * cuePlayerEntry = createEntry(
|
||||||
cuePlayerEntry->set_text(*optionsContainer->getOptionItem(
|
OptionsContainer::cuePlayerDeviceName);
|
||||||
OptionsContainer::cuePlayerDeviceName ));
|
|
||||||
audioDeviceTable->attach(*cuePlayerEntry, 1, 2, 0, 1);
|
audioDeviceTable->attach(*cuePlayerEntry, 1, 2, 0, 1);
|
||||||
|
|
||||||
// display the settings for the output player device
|
// display the settings for the output player device
|
||||||
|
@ -296,11 +291,11 @@ OptionsWindow :: constructSoundSection(void) throw ()
|
||||||
}
|
}
|
||||||
Gtk::Label * outputPlayerLabel = Gtk::manage(
|
Gtk::Label * outputPlayerLabel = Gtk::manage(
|
||||||
new Gtk::Label(outputPlayerLabelContents) );
|
new Gtk::Label(outputPlayerLabelContents) );
|
||||||
audioDeviceTable->attach(*outputPlayerLabel, 0, 1, 1, 2);
|
audioDeviceTable->attach(*outputPlayerLabel,
|
||||||
|
0, 1, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 5, 0);
|
||||||
|
|
||||||
outputPlayerEntry = Gtk::manage(wf->createEntryBin());
|
EntryBin * outputPlayerEntry = createEntry(
|
||||||
outputPlayerEntry->set_text(*optionsContainer->getOptionItem(
|
OptionsContainer::outputPlayerDeviceName);
|
||||||
OptionsContainer::outputPlayerDeviceName ));
|
|
||||||
audioDeviceTable->attach(*outputPlayerEntry, 1, 2, 1, 2);
|
audioDeviceTable->attach(*outputPlayerEntry, 1, 2, 1, 2);
|
||||||
|
|
||||||
// make a new box and pack the components into it
|
// make a new box and pack the components into it
|
||||||
|
@ -310,3 +305,143 @@ OptionsWindow :: constructSoundSection(void) throw ()
|
||||||
return section;
|
return section;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Construct the "Servers" section.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
Gtk::VBox*
|
||||||
|
OptionsWindow :: constructServersSection(void) throw ()
|
||||||
|
{
|
||||||
|
Ptr<OptionsContainer>::Ref optionsContainer
|
||||||
|
= gLiveSupport->getOptionsContainer();
|
||||||
|
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
|
||||||
|
|
||||||
|
// the settings for the authentication server
|
||||||
|
Gtk::Table * authenticationTable = Gtk::manage(new Gtk::Table);
|
||||||
|
authenticationTable->set_row_spacings(5);
|
||||||
|
authenticationTable->set_col_spacings(5);
|
||||||
|
|
||||||
|
Gtk::Label * authenticationLabel;
|
||||||
|
Gtk::Label * authenticationServerLabel;
|
||||||
|
Gtk::Label * authenticationPortLabel;
|
||||||
|
Gtk::Label * authenticationPathLabel;
|
||||||
|
try {
|
||||||
|
authenticationLabel = Gtk::manage(new Gtk::Label(
|
||||||
|
*getResourceUstring("authenticationLabel") ));
|
||||||
|
authenticationServerLabel = Gtk::manage(new Gtk::Label(
|
||||||
|
*getResourceUstring("serverLabel") ));
|
||||||
|
authenticationPortLabel = Gtk::manage(new Gtk::Label(
|
||||||
|
*getResourceUstring("portLabel") ));
|
||||||
|
authenticationPathLabel = Gtk::manage(new Gtk::Label(
|
||||||
|
*getResourceUstring("pathLabel") ));
|
||||||
|
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
// TODO: signal error
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
std::exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
authenticationTable->attach(*authenticationLabel,
|
||||||
|
0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 5, 0);
|
||||||
|
authenticationTable->attach(*authenticationServerLabel,
|
||||||
|
1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
|
||||||
|
authenticationTable->attach(*authenticationPortLabel,
|
||||||
|
1, 2, 1, 2, Gtk::SHRINK, Gtk::SHRINK);
|
||||||
|
authenticationTable->attach(*authenticationPathLabel,
|
||||||
|
1, 2, 2, 3, Gtk::SHRINK, Gtk::SHRINK);
|
||||||
|
|
||||||
|
EntryBin * authenticationServerEntry = createEntry(
|
||||||
|
OptionsContainer::authenticationServer);
|
||||||
|
EntryBin * authenticationPortEntry = createEntry(
|
||||||
|
OptionsContainer::authenticationPort);
|
||||||
|
EntryBin * authenticationPathEntry = createEntry(
|
||||||
|
OptionsContainer::authenticationPath);
|
||||||
|
|
||||||
|
authenticationTable->attach(*authenticationServerEntry, 2, 3, 0, 1);
|
||||||
|
authenticationTable->attach(*authenticationPortEntry, 2, 3, 1, 2);
|
||||||
|
authenticationTable->attach(*authenticationPathEntry, 2, 3, 2, 3);
|
||||||
|
|
||||||
|
// the settings for the storage server
|
||||||
|
Gtk::Table * storageTable = Gtk::manage(new Gtk::Table);
|
||||||
|
storageTable->set_row_spacings(5);
|
||||||
|
storageTable->set_col_spacings(5);
|
||||||
|
|
||||||
|
Gtk::Label * storageLabel;
|
||||||
|
Gtk::Label * storageServerLabel;
|
||||||
|
Gtk::Label * storagePortLabel;
|
||||||
|
Gtk::Label * storagePathLabel;
|
||||||
|
try {
|
||||||
|
storageLabel = Gtk::manage(new Gtk::Label(
|
||||||
|
*getResourceUstring("storageLabel") ));
|
||||||
|
storageServerLabel = Gtk::manage(new Gtk::Label(
|
||||||
|
*getResourceUstring("serverLabel") ));
|
||||||
|
storagePortLabel = Gtk::manage(new Gtk::Label(
|
||||||
|
*getResourceUstring("portLabel") ));
|
||||||
|
storagePathLabel = Gtk::manage(new Gtk::Label(
|
||||||
|
*getResourceUstring("pathLabel") ));
|
||||||
|
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
// TODO: signal error
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
std::exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
storageTable->attach(*storageLabel,
|
||||||
|
0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 5, 0);
|
||||||
|
storageTable->attach(*storageServerLabel,
|
||||||
|
1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
|
||||||
|
storageTable->attach(*storagePortLabel,
|
||||||
|
1, 2, 1, 2, Gtk::SHRINK, Gtk::SHRINK);
|
||||||
|
storageTable->attach(*storagePathLabel,
|
||||||
|
1, 2, 2, 3, Gtk::SHRINK, Gtk::SHRINK);
|
||||||
|
|
||||||
|
EntryBin * storageServerEntry = createEntry(
|
||||||
|
OptionsContainer::storageServer);
|
||||||
|
EntryBin * storagePortEntry = createEntry(
|
||||||
|
OptionsContainer::storagePort);
|
||||||
|
EntryBin * storagePathEntry = createEntry(
|
||||||
|
OptionsContainer::storagePath);
|
||||||
|
|
||||||
|
storageTable->attach(*storageServerEntry, 2, 3, 0, 1);
|
||||||
|
storageTable->attach(*storagePortEntry, 2, 3, 1, 2);
|
||||||
|
storageTable->attach(*storagePathEntry, 2, 3, 2, 3);
|
||||||
|
|
||||||
|
// make a new box and pack the components into it
|
||||||
|
Gtk::VBox * section = Gtk::manage(new Gtk::VBox);
|
||||||
|
section->pack_start(*authenticationTable, Gtk::PACK_SHRINK, 10);
|
||||||
|
section->pack_start(*storageTable, Gtk::PACK_SHRINK, 10);
|
||||||
|
|
||||||
|
return section;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Construct the "About" section.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
Gtk::VBox*
|
||||||
|
OptionsWindow :: constructAboutSection(void) throw ()
|
||||||
|
{
|
||||||
|
Glib::ustring aboutLabelContents;
|
||||||
|
aboutLabelContents.append("\n\n");
|
||||||
|
aboutLabelContents.append(PACKAGE_NAME);
|
||||||
|
aboutLabelContents.append(" ");
|
||||||
|
aboutLabelContents.append(PACKAGE_VERSION);
|
||||||
|
aboutLabelContents.append("\n\n");
|
||||||
|
try {
|
||||||
|
aboutLabelContents.append(*formatMessage("reportBugsToText",
|
||||||
|
PACKAGE_BUGREPORT ));
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
// TODO: signal error
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
std::exit(1);
|
||||||
|
}
|
||||||
|
Gtk::Label * aboutLabel = Gtk::manage(
|
||||||
|
new Gtk::Label(aboutLabelContents) );
|
||||||
|
|
||||||
|
// make a new box and pack the components into it
|
||||||
|
Gtk::VBox * section = Gtk::manage(new Gtk::VBox);
|
||||||
|
section->pack_start(*aboutLabel, Gtk::PACK_SHRINK, 5);
|
||||||
|
|
||||||
|
return section;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,14 +120,15 @@ class OptionsWindow : public WhiteWindow, public LocalizedObject
|
||||||
Gtk::Button * okButton;
|
Gtk::Button * okButton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The entry field for the cue player device's name.
|
* The type for the list of user entry fields of string type.
|
||||||
*/
|
*/
|
||||||
EntryBin * cuePlayerEntry;
|
typedef std::vector<std::pair<OptionsContainer::OptionItemString,
|
||||||
|
EntryBin*> > StringEntryListType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The entry field for the output player device's name.
|
* The list of user entry fields of string type.
|
||||||
*/
|
*/
|
||||||
EntryBin * outputPlayerEntry;
|
StringEntryListType stringEntryList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The gLiveSupport object, handling the logic of the application.
|
* The gLiveSupport object, handling the logic of the application.
|
||||||
|
@ -140,12 +141,18 @@ class OptionsWindow : public WhiteWindow, public LocalizedObject
|
||||||
bool isChanged;
|
bool isChanged;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the "About" section.
|
* Create a new user entry field item.
|
||||||
*
|
*
|
||||||
* @return a pointer to the new box (already Gtk::manage()'ed)
|
* This constructs [and Gtk::manage()s] the EntryBin, and
|
||||||
|
* sets its text to the current value of the option.
|
||||||
|
* The EntryBin is then added to the list of user entry fields.
|
||||||
|
*
|
||||||
|
* @param optionItem the name of the option item for this entry
|
||||||
|
* @return the newly created EntryBin
|
||||||
*/
|
*/
|
||||||
Gtk::VBox*
|
EntryBin *
|
||||||
constructAboutSection(void) throw ();
|
createEntry(OptionsContainer::OptionItemString optionItem)
|
||||||
|
throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the "Sound" section.
|
* Construct the "Sound" section.
|
||||||
|
@ -155,6 +162,22 @@ class OptionsWindow : public WhiteWindow, public LocalizedObject
|
||||||
Gtk::VBox*
|
Gtk::VBox*
|
||||||
constructSoundSection(void) throw ();
|
constructSoundSection(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct the "Servers" section.
|
||||||
|
*
|
||||||
|
* @return a pointer to the new box (already Gtk::manage()'ed)
|
||||||
|
*/
|
||||||
|
Gtk::VBox*
|
||||||
|
constructServersSection(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct the "About" section.
|
||||||
|
*
|
||||||
|
* @return a pointer to the new box (already Gtk::manage()'ed)
|
||||||
|
*/
|
||||||
|
Gtk::VBox*
|
||||||
|
constructAboutSection(void) throw ();
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -221,17 +221,24 @@ root:table
|
||||||
{
|
{
|
||||||
windowTitle:string { "LiveSupport Options Window" }
|
windowTitle:string { "LiveSupport Options Window" }
|
||||||
|
|
||||||
aboutSectionLabel:string { "About" }
|
|
||||||
soundSectionLabel:string { "Sound" }
|
soundSectionLabel:string { "Sound" }
|
||||||
|
serversSectionLabel:string { "Servers" }
|
||||||
|
aboutSectionLabel:string { "About" }
|
||||||
|
|
||||||
cancelButtonLabel:string { "Cancel" }
|
cancelButtonLabel:string { "Cancel" }
|
||||||
applyButtonLabel:string { "Apply" }
|
applyButtonLabel:string { "Apply" }
|
||||||
okButtonLabel:string { "OK" }
|
okButtonLabel:string { "OK" }
|
||||||
|
|
||||||
reportBugsToText:string { "Report bugs to: {0}" }
|
|
||||||
|
|
||||||
cueDeviceLabel:string { "Cue audio device:" }
|
cueDeviceLabel:string { "Cue audio device:" }
|
||||||
outputDeviceLabel:string { "Live Mode audio device:" }
|
outputDeviceLabel:string { "Live Mode audio device:" }
|
||||||
|
|
||||||
|
authenticationLabel:string { "Authentication server" }
|
||||||
|
storageLabel:string { "Storage server" }
|
||||||
|
serverLabel:string { "address:" }
|
||||||
|
portLabel:string { "port:" }
|
||||||
|
pathLabel:string { "path:" }
|
||||||
|
|
||||||
|
reportBugsToText:string { "Report bugs to: {0}" }
|
||||||
}
|
}
|
||||||
|
|
||||||
metadataTypes:table
|
metadataTypes:table
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue