mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-04-06 06:43:49 +00:00
PowerControl: Allow to set Autostart Profile Settings
This commit is contained in:
parent
acd33f2cb2
commit
cf0de0ad8f
4 changed files with 51 additions and 4 deletions
|
|
@ -155,10 +155,50 @@ namespace PowerControl.Menu
|
|||
toolStripItem.DropDownItems.Add(item);
|
||||
}
|
||||
|
||||
AddMenuItemsToModifyProfile(
|
||||
PowerControl.Options.Profiles.Controller?.AutostartProfileSettings,
|
||||
toolStripItem.DropDownItems
|
||||
);
|
||||
|
||||
toolStripItem.Visible = Visible && Options.Count > 0;
|
||||
};
|
||||
}
|
||||
|
||||
private void AddMenuItemsToModifyProfile(Helper.ProfileSettings? profileSettings, ToolStripItemCollection dropDownItems)
|
||||
{
|
||||
if (profileSettings is null || PersistentKey is null)
|
||||
return;
|
||||
|
||||
dropDownItems.Add(new ToolStripSeparator());
|
||||
|
||||
var headingItem = new ToolStripMenuItem(profileSettings.ProfileName + ": ");
|
||||
dropDownItems.Add(headingItem);
|
||||
|
||||
var persistedValue = profileSettings.GetValue(PersistentKey);
|
||||
|
||||
foreach (var option in Options)
|
||||
{
|
||||
var item = new ToolStripMenuItem("Set: " + option);
|
||||
item.Checked = option == persistedValue;
|
||||
item.Click += delegate { profileSettings.SetValue(PersistentKey, option); };
|
||||
headingItem.DropDownItems.Add(item);
|
||||
}
|
||||
|
||||
if (persistedValue is not null)
|
||||
{
|
||||
headingItem.Text += persistedValue;
|
||||
headingItem.Checked = true;
|
||||
|
||||
headingItem.DropDownItems.Add(new ToolStripSeparator());
|
||||
var unsetItem = headingItem.DropDownItems.Add("Unset");
|
||||
unsetItem.Click += delegate { profileSettings.DeleteKey(PersistentKey); };
|
||||
}
|
||||
else
|
||||
{
|
||||
headingItem.Text += "Not set";
|
||||
}
|
||||
}
|
||||
|
||||
private void SelectIndex(int index)
|
||||
{
|
||||
if (Options.Count == 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue