Skip to content

Commit

Permalink
Merge remote-tracking branch 'FEAT-4263-Rework_TV_Radio_Configuration…
Browse files Browse the repository at this point in the history
…' Fixed Mantis 4263: Second commit to master
  • Loading branch information
Sebastiii committed Mar 31, 2013
2 parents be91f65 + e9082dd commit a167120
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 12 deletions.
32 changes: 26 additions & 6 deletions mediaportal/Configuration/Sections/Radio.cs
Expand Up @@ -21,6 +21,7 @@
#region Using

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using MediaPortal.Profile;
using MediaPortal.UserInterface.Controls;
Expand Down Expand Up @@ -256,14 +257,33 @@ private void comboBoxGroups_DropDown(object sender, EventArgs e)
// Fill comboBox with radio channel names
comboBoxGroups.Items.Clear();
comboBoxGroups.Items.Add("(none)");

int selectedIdx = 0;
TvServerRemote.HostName = TVRadio.Hostname;
foreach (string groupName in TvServerRemote.GetRadioChannelGroupNames())

if (string.IsNullOrEmpty(TVRadio.Hostname))
{
MessageBox.Show("Unable to get radio channel groups from the TV Server." +
Environment.NewLine + "No valid hostname specified in the \"TV/Radio\" section.",
"Radio Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
else
{
int idx = comboBoxGroups.Items.Add(groupName);
if (groupName == _rootGroup)
selectedIdx = idx;
TvServerRemote.HostName = TVRadio.Hostname;
List<string> groupNames = TvServerRemote.GetRadioChannelGroupNames();
if (groupNames.Count == 0)
{
MessageBox.Show(string.Format("Unable to get radio channel groups from the TV Server on host \"{0}\".", TVRadio.Hostname) +
Environment.NewLine + "Version incompatibility of MP Client and TV Server?",
"Radio Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
else
{
foreach (string groupName in groupNames)
{
int idx = comboBoxGroups.Items.Add(groupName);
if (groupName == _rootGroup)
selectedIdx = idx;
}
}
}
comboBoxGroups.SelectedIndex = selectedIdx;

Expand Down
12 changes: 6 additions & 6 deletions mediaportal/Configuration/Sections/TVRadio.cs
Expand Up @@ -390,7 +390,7 @@ private bool VerifyHostname(string hostname, bool verbose)
Log.Debug("VerifyHostname: unable to connect to TV server on host \"{0}\"", hostname);
if (verbose)
MessageBox.Show(string.Format("Unable to connect to TV server on host \"{0}\"", hostname),
"TV Client Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
"TV/Radio Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return false;
}

Expand All @@ -405,7 +405,7 @@ private bool VerifyHostname(string hostname, bool verbose)
Log.Debug("VerifyHostname: unable to get data from TV server on host \"{0}\"", hostname);
if (verbose)
MessageBox.Show(string.Format("Unable to get data from TV server on host \"{0}\"", hostname),
"TV Client Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
"TV/Radio Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return false;
}

Expand Down Expand Up @@ -477,7 +477,7 @@ private bool UpdateGentleConfig(string hostname, bool unchanged)
{
Log.Error("UpdateGentleConfig: unable to open gentle.config" + Environment.NewLine + "{0}", ex.Message);
MessageBox.Show(string.Format("Unable to open gentle.config" + Environment.NewLine + "{0}", ex.Message),
"TV Client Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
"TV/Radio Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return false;
}

Expand All @@ -502,7 +502,7 @@ private bool UpdateGentleConfig(string hostname, bool unchanged)
{
Log.Error("UpdateGentleConfig: unable to get database connection string from TV server \"{0}\"", hostname);
MessageBox.Show(string.Format("Unable to get database connection string from TV server \"{0}\"", hostname),
"TV Client Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
"TV/Radio Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return false;
}

Expand All @@ -517,7 +517,7 @@ private bool UpdateGentleConfig(string hostname, bool unchanged)
{
Log.Error("UpdateGentleConfig: unable to modify gentle.config" + Environment.NewLine + "{0}", ex.Message);
MessageBox.Show(string.Format("Unable to modify gentle.config" + Environment.NewLine + "{0}", ex.Message),
"TV Client Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
"TV/Radio Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return false;
}

Expand Down Expand Up @@ -705,7 +705,7 @@ private void mpButtonTestConnection_Click(object sender, EventArgs e)

// Show success message
MessageBox.Show("Connection to the TV server successful",
"TV Client Settings", MessageBoxButtons.OK, MessageBoxIcon.None);
"TV/Radio Settings", MessageBoxButtons.OK, MessageBoxIcon.None);
}
}

Expand Down

0 comments on commit a167120

Please sign in to comment.