Add chapter display to playlist view

Implements partly #8
This commit is contained in:
Juergen Tem 2018-11-10 17:40:17 +01:00
parent 6a32dc258b
commit cfff035b13
No known key found for this signature in database
GPG Key ID: 0A9625B1654DCE28
6 changed files with 65 additions and 13 deletions

View File

@ -309,15 +309,15 @@ namespace BDInfo
private void ResetColumnWidths()
{
listViewPlaylistFiles.Columns[0].Width =
(int)(listViewPlaylistFiles.ClientSize.Width * 0.23);
(int)(listViewPlaylistFiles.ClientSize.Width * 0.30);
listViewPlaylistFiles.Columns[1].Width =
(int)(listViewPlaylistFiles.ClientSize.Width * 0.08);
(int)(listViewPlaylistFiles.ClientSize.Width * 0.07);
listViewPlaylistFiles.Columns[2].Width =
(int)(listViewPlaylistFiles.ClientSize.Width * 0.23);
(int)(listViewPlaylistFiles.ClientSize.Width * 0.21);
listViewPlaylistFiles.Columns[3].Width =
(int)(listViewPlaylistFiles.ClientSize.Width * 0.23);
(int)(listViewPlaylistFiles.ClientSize.Width * 0.21);
listViewPlaylistFiles.Columns[4].Width =
(int)(listViewPlaylistFiles.ClientSize.Width * 0.23);
(int)(listViewPlaylistFiles.ClientSize.Width * 0.21);
listViewStreamFiles.Columns[0].Width =
(int)(listViewStreamFiles.ClientSize.Width * 0.23);
@ -653,6 +653,11 @@ namespace BDInfo
playlistName.Text = playlist.Name;
playlistName.Tag = playlist.Name;
if (playlist.Chapters != null && playlist.Chapters.Count > 1 && BDInfoSettings.DisplayChapterCount)
playlistName.Text += string.Format(CultureInfo.InvariantCulture,
" [{0:D2} Chapters]",
playlist.Chapters.Count);
TimeSpan playlistLengthSpan =
new TimeSpan((long)(playlist.TotalLength * 10000000));
ListViewItem.ListViewSubItem playlistLength =
@ -735,7 +740,7 @@ namespace BDInfo
if (playlistItem == null) return;
TSPlaylistFile playlist = null;
string playlistFileName = playlistItem.Text;
string playlistFileName = (string)playlistItem.SubItems[0].Tag;
if (BDROM.PlaylistFiles.ContainsKey(playlistFileName))
{
playlist = BDROM.PlaylistFiles[playlistFileName];
@ -1301,9 +1306,9 @@ namespace BDInfo
foreach (ListViewItem item
in listViewPlaylistFiles.Items)
{
if (BDROM.PlaylistFiles.ContainsKey(item.Text))
if (BDROM.PlaylistFiles.ContainsKey(item.SubItems[0].Tag.ToString()))
{
playlists.Add(BDROM.PlaylistFiles[item.Text]);
playlists.Add(BDROM.PlaylistFiles[item.SubItems[0].Tag.ToString()]);
}
}
}
@ -1312,9 +1317,9 @@ namespace BDInfo
foreach (ListViewItem item
in listViewPlaylistFiles.CheckedItems)
{
if (BDROM.PlaylistFiles.ContainsKey(item.Text))
if (BDROM.PlaylistFiles.ContainsKey(item.SubItems[0].Tag.ToString()))
{
playlists.Add(BDROM.PlaylistFiles[item.Text]);
playlists.Add(BDROM.PlaylistFiles[item.SubItems[0].Tag.ToString()]);
}
}
}

View File

@ -61,6 +61,7 @@ namespace BDInfo
this.textBoxUseImagePrefixValue = new System.Windows.Forms.TextBox();
this.checkBoxEnableSSIF = new System.Windows.Forms.CheckBox();
this.checkBoxExtendedStreamDiagnostics = new System.Windows.Forms.CheckBox();
this.checkBoxDisplayChapterCount = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// checkBoxFilterLoopingPlaylists
@ -88,7 +89,7 @@ namespace BDInfo
// buttonCancel
//
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Location = new System.Drawing.Point(126, 218);
this.buttonCancel.Location = new System.Drawing.Point(126, 241);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 6;
@ -98,7 +99,7 @@ namespace BDInfo
//
// buttonOK
//
this.buttonOK.Location = new System.Drawing.Point(45, 218);
this.buttonOK.Location = new System.Drawing.Point(45, 241);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 5;
@ -209,13 +210,24 @@ namespace BDInfo
this.checkBoxExtendedStreamDiagnostics.Text = "Extended video stream diagnostics.";
this.checkBoxExtendedStreamDiagnostics.UseVisualStyleBackColor = true;
//
// checkBoxDisplayChapterCount
//
this.checkBoxDisplayChapterCount.AutoSize = true;
this.checkBoxDisplayChapterCount.Location = new System.Drawing.Point(11, 214);
this.checkBoxDisplayChapterCount.Name = "checkBoxDisplayChapterCount";
this.checkBoxDisplayChapterCount.Size = new System.Drawing.Size(200, 17);
this.checkBoxDisplayChapterCount.TabIndex = 14;
this.checkBoxDisplayChapterCount.Text = "Display chapter count in Playlist view";
this.checkBoxDisplayChapterCount.UseVisualStyleBackColor = true;
//
// FormSettings
//
this.AcceptButton = this.buttonOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(243, 250);
this.ClientSize = new System.Drawing.Size(243, 273);
this.Controls.Add(this.checkBoxDisplayChapterCount);
this.Controls.Add(this.checkBoxExtendedStreamDiagnostics);
this.Controls.Add(this.checkBoxEnableSSIF);
this.Controls.Add(this.textBoxUseImagePrefixValue);
@ -256,5 +268,6 @@ namespace BDInfo
private System.Windows.Forms.TextBox textBoxUseImagePrefixValue;
private System.Windows.Forms.CheckBox checkBoxEnableSSIF;
private System.Windows.Forms.CheckBox checkBoxExtendedStreamDiagnostics;
private System.Windows.Forms.CheckBox checkBoxDisplayChapterCount;
}
}

View File

@ -39,6 +39,7 @@ namespace BDInfo
textBoxUseImagePrefixValue.Text = BDInfoSettings.UseImagePrefixValue;
checkBoxKeepStreamOrder.Checked = BDInfoSettings.KeepStreamOrder;
checkBoxEnableSSIF.Checked = BDInfoSettings.EnableSSIF;
checkBoxDisplayChapterCount.Checked = BDInfoSettings.DisplayChapterCount;
}
private void buttonOK_Click(object sender, EventArgs e)
@ -53,6 +54,7 @@ namespace BDInfo
BDInfoSettings.FilterLoopingPlaylists = checkBoxFilterLoopingPlaylists.Checked;
BDInfoSettings.FilterShortPlaylists = checkBoxFilterShortPlaylists.Checked;
BDInfoSettings.EnableSSIF = checkBoxEnableSSIF.Checked;
BDInfoSettings.DisplayChapterCount = checkBoxDisplayChapterCount.Checked;
int filterShortPlaylistsValue;
if (int.TryParse(textBoxFilterShortPlaylistsValue.Text, out filterShortPlaylistsValue))
{
@ -115,6 +117,20 @@ namespace BDInfo
}
}
public static bool DisplayChapterCount
{
get
{
try { return Properties.Settings.Default.DisplayChapterCount; }
catch { return false; }
}
set
{
try { Properties.Settings.Default.DisplayChapterCount = value; }
catch { }
}
}
public static bool AutosaveReport
{
get

View File

@ -202,5 +202,17 @@ namespace BDInfo.Properties {
this["WindowSize"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool DisplayChapterCount {
get {
return ((bool)(this["DisplayChapterCount"]));
}
set {
this["DisplayChapterCount"] = value;
}
}
}
}

View File

@ -47,5 +47,8 @@
<Setting Name="WindowSize" Type="System.Drawing.Size" Scope="User">
<Value Profile="(Default)">800, 614</Value>
</Setting>
<Setting Name="DisplayChapterCount" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -52,6 +52,9 @@
<setting name="WindowSize" serializeAs="String">
<value>800, 614</value>
</setting>
<setting name="DisplayChapterCount" serializeAs="String">
<value>False</value>
</setting>
</BDInfo.Properties.Settings>
</userSettings>
</configuration>