Skip to content

Commit

Permalink
Added a button to reload available profiles from disk
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadnix-was-taken committed Dec 15, 2021
1 parent 5670479 commit cce60ba
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
18 changes: 13 additions & 5 deletions Settings/UI/MainSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,9 @@ public async void OnUpdateSaberOffset(float _)
[UIAction("#profile-save")]
public void OnProfileSave() => SaveProfile();

[UIAction("#profile-list-reload")]
public void OnProfileListReload() => RefreshProfileList();

public void Awake()
{
if (ProfileManager.profilesPresent)
Expand Down Expand Up @@ -722,11 +725,7 @@ private void DeleteProfile()
bool deleteSuccessful = ProfileManager.DeleteProfile(profileName, out string statusMsg);

// Refresh UI
ProfileManager.LoadProfiles();
ddlsProfiles.values = ProfileManager.profileNames;
profileListSelected = ddlsProfiles.values[0].ToString();
ddlsProfiles.UpdateChoices();
parserParams.EmitEvent("refresh-profile-list");
RefreshProfileList();

if (!deleteSuccessful)
{
Expand Down Expand Up @@ -782,6 +781,15 @@ private void SaveProfile()
ProfileStatusText.text = statusMsg;
}

private void RefreshProfileList()
{
ProfileManager.LoadProfiles();
ddlsProfiles.values = ProfileManager.profileNames;
profileListSelected = ddlsProfiles.values[0].ToString();
ddlsProfiles.UpdateChoices();
parserParams.EmitEvent("refresh-profile-list");
}

private void UpdateSaberPosIncrement(PositionUnit unit)
{
switch (unit)
Expand Down
5 changes: 3 additions & 2 deletions Settings/UI/Views/mainsettings.bsml
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,9 @@
<!--Profile Management-->
<settings-submenu text='→ Manage config profiles...' hover-hint='Load/Save/Delete config profiles.'>
<settings-container>
<horizontal>
<clickable-text text='⮌ Back' align='Left' click-event='back' />
<horizontal pref-width='90' spacing='35'>
<button text='⮌ Back' align='Left' click-event='back' />
<button text='Reload profile list' align='Right' click-event='profile-list-reload' />
</horizontal>
<horizontal>
<dropdown-list-setting text='Existing profiles:' value='profile-list-value' get-event='refresh-profile-list'
Expand Down

0 comments on commit cce60ba

Please sign in to comment.