Skip to content

Commit

Permalink
allow changing the style of the whole playlist
Browse files Browse the repository at this point in the history
  • Loading branch information
zefanjajobse committed Jan 31, 2024
1 parent a709495 commit 77ff487
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 14 deletions.
10 changes: 5 additions & 5 deletions PlanningCenter to OPS/Actions/ToXml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal static XElement SongNode(Config config, string song_name, string song_t
new XElement("Number", song_number),
new XElement("SongBookName", book.SongBookName),
new XElement("Keys"),
new XElement("StyleName", book.StyleName),
new XElement("StyleName", config.last_used_ops_theme),
new XElement("Title", song_name),
new XElement("SelectedVersion", book.SelectedVersion),
new XElement("Language", "All"),
Expand All @@ -33,13 +33,13 @@ internal static XElement SongNode(Config config, string song_name, string song_t

}

internal static XElement SongFileNode(string song_name, string save_location)
internal static XElement SongFileNode(Config config, string song_name)
{
XElement doc = new XElement("SongFromFile",
new XElement("Comment"),
new XElement("DisplayTitle", song_name),
new XElement("FileName", String.Format("{0}\\{1}.txt", save_location, song_name)),
new XElement("StyleName", "OPS")
new XElement("FileName", String.Format("{0}\\{1}.txt", config.song_folder, song_name)),
new XElement("StyleName", config.last_used_ops_theme)
);
doc.SetAttributeValue("ID", Guid.NewGuid().ToString());
doc.SetAttributeValue("Type", "Song");
Expand Down Expand Up @@ -72,7 +72,7 @@ internal static XElement GetSongs(Config config, List<DrawFormItems> song_list)
} else if (current.Type == "file")
{
LyricsToFile.ToFile(config, current.Detailed);
xml_list.Add(SongFileNode(title, config.song_folder));
xml_list.Add(SongFileNode(config, title));
} else
{
xml_list.Add(SongNode(config, title, config.et_abbreviation, current.Id.ToString()));
Expand Down
2 changes: 0 additions & 2 deletions PlanningCenter to OPS/BookTypes/EigenTeksten.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ public EigenTeksten(Config config)
}
public override string SongBookName => this.override_name;

public override string StyleName => "OPS";

public override string SelectedVersion => "MyVersion";
}
}
1 change: 0 additions & 1 deletion PlanningCenter to OPS/BookTypes/Init.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
internal abstract class BookType
{
public abstract string SongBookName { get; }
public abstract string StyleName { get; }
public abstract string SelectedVersion { get; }

}
Expand Down
2 changes: 0 additions & 2 deletions PlanningCenter to OPS/BookTypes/KinderOpwekking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ internal class KinderOpwekking : BookType
{
public override string SongBookName => "Kinderen";

public override string StyleName => "OPS";

public override string SelectedVersion => "ProjectionVersion";
}
}
2 changes: 0 additions & 2 deletions PlanningCenter to OPS/BookTypes/Opwekking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ internal class Opwekking : BookType
{
public override string SongBookName => "Opwekking";

public override string StyleName => "OPS";

public override string SelectedVersion => "ProjectionVersion";
}
}
3 changes: 3 additions & 0 deletions PlanningCenter to OPS/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ internal class Config
public string et_abbreviation;
public string et_bundle_name;
public bool et_enabled;
public string last_used_ops_theme;

public Config()
{
Expand All @@ -29,6 +30,7 @@ public Config()
et_abbreviation = Properties.Settings.Default.et_abbreviation;
et_bundle_name = Properties.Settings.Default.et_bundle_name;
et_enabled = Properties.Settings.Default.et_enabled;
last_used_ops_theme = Properties.Settings.Default.last_used_ops_theme;
}

public void Update()
Expand All @@ -45,6 +47,7 @@ public void Update()
Properties.Settings.Default.et_abbreviation = et_abbreviation;
Properties.Settings.Default.et_bundle_name = et_bundle_name;
Properties.Settings.Default.et_enabled = et_enabled;
Properties.Settings.Default.last_used_ops_theme = last_used_ops_theme;
Properties.Settings.Default.Save();
}
}
Expand Down
16 changes: 14 additions & 2 deletions PlanningCenter to OPS/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ public void RefreshItems()
{
OpsThemeSelector.Items.Add(node.InnerText);
}
Debug.WriteLine(config.last_used_ops_theme);
if (config.last_used_ops_theme != "")
{
OpsThemeSelector.SelectedItem = config.last_used_ops_theme;
} else
{
OpsThemeSelector.SelectedIndex = 0;
}
}

private void CheckPlan()
Expand Down Expand Up @@ -101,12 +109,13 @@ private void PlanSelector_SelectedIndexChanged(object sender, EventArgs e)

private void SaveButton_Click(object sender, EventArgs e)
{
config.Update();
if (current_plan != null)
{
try
{
Structs.SongList song_return = Api.GetSongList(config, PlansInfo[current_plan]);
using (SelectSongs select_songs = new SelectSongs(this.config, song_return))
using (SelectSongs select_songs = new SelectSongs(config, song_return))
{
DialogResult result = select_songs.ShowDialog();
}
Expand Down Expand Up @@ -147,7 +156,10 @@ private void ReadSongs_Click(object sender, EventArgs e)

private void OpsThemeSelector_SelectedIndexChanged(object sender, EventArgs e)
{

ComboBox cmb = (ComboBox)sender;
string current = (string)cmb.SelectedItem;
if (current == null) return;
config.last_used_ops_theme = current;
}
}

Expand Down

0 comments on commit 77ff487

Please sign in to comment.