Permalink
Browse files

Change the BackendServerIP settings to combo boxes showing the availa…

…ble values. Makes configuration a little easy and invalid configurations harder.
  • Loading branch information...
stuartm committed Oct 6, 2012
1 parent 6902966 commit 0a40fff4d7c2d1f1b07eb1f0524a89b06e1270a7
Showing with 28 additions and 12 deletions.
  1. +28 −12 mythtv/programs/mythtv-setup/backendsettings.cpp
@@ -9,10 +9,17 @@
#include <unistd.h>
static HostLineEdit *LocalServerIP()
static HostComboBox *LocalServerIP()
{
HostLineEdit *gc = new HostLineEdit("BackendServerIP");
gc->setLabel(QObject::tr("IP address"));
HostComboBox *gc = new HostComboBox("BackendServerIP");
gc->setLabel(QObject::tr("IPv4 address"));
QList<QHostAddress> list = ServerPool::DefaultListenIPv4();
QList<QHostAddress>::iterator it;
for (it = list.begin(); it != list.end(); ++it)
{
gc->addSelection((*it).toString(), (*it).toString());
}
gc->setValue("127.0.0.1");
gc->setHelpText(QObject::tr("Enter the IP address of this machine. "
"Use an externally accessible address (ie, not "
@@ -23,25 +30,34 @@ static HostLineEdit *LocalServerIP()
return gc;
};
static HostLineEdit *LocalServerIP6()
static HostComboBox *LocalServerIP6()
{
HostLineEdit *gc = new HostLineEdit("BackendServerIP6");
HostComboBox *gc = new HostComboBox("BackendServerIP6");
gc->setLabel(QObject::tr("IPv6 address"));
gc->setValue("");
gc->setHelpText(QObject::tr("Enter the IPv6 address of this machine. "
"Use an externally accessible address (ie, not "
"::1) if you are going to be running a frontend "
"on a different machine than this one."));
QList<QHostAddress> list = ServerPool::DefaultListenIPv6();
QList<QHostAddress>::iterator it;
for (it = list.begin(); it != list.end(); ++it)
{
gc->addSelection((*it).toString(), (*it).toString());
}
#if defined(QT_NO_IPV6)
gc->setEnabled(false);
gc->setValue("");
#else
if (ServerPool::DefaultListenIPv6().isEmpty())
if (list.isEmpty())
{
gc->setEnabled(false);
gc->setValue("");
}
else if (ServerPool::DefaultListenIPv6().contains(QHostAddress("::1")))
else if (list.contains(QHostAddress("::1")))
gc->setValue("::1");
#endif
gc->setHelpText(QObject::tr("Enter the IPv6 address of this machine. "
"Use an externally accessible address (ie, not "
"::1) if you are going to be running a frontend "
"on a different machine than this one."));
return gc;
}

0 comments on commit 0a40fff

Please sign in to comment.