feat: editable inputs in xlsettings

This commit is contained in:
Raymond 2021-09-14 11:02:56 -04:00
parent 2d3e225e2c
commit ae7d5ed8b5

View file

@ -295,6 +295,14 @@ namespace Dalamud.Interface.Internal.Windows
#region Custom repos #region Custom repos
ImGui.Text(Loc.Localize("DalamudSettingsCustomRepo", "Custom Plugin Repositories")); ImGui.Text(Loc.Localize("DalamudSettingsCustomRepo", "Custom Plugin Repositories"));
if (this.thirdRepoListChanged)
{
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.HealerGreen);
ImGui.SameLine();
ImGui.Text(Loc.Localize("DalamudSettingsChanged", "(Changed)"));
ImGui.PopStyleColor();
}
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingCustomRepoHint", "Add custom plugin repositories.")); ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingCustomRepoHint", "Add custom plugin repositories."));
ImGui.TextColored(this.warnTextColor, Loc.Localize("DalamudSettingCustomRepoWarning", "We cannot take any responsibility for third-party plugins and repositories.\nTake care when installing third-party plugins from untrusted sources.")); ImGui.TextColored(this.warnTextColor, Loc.Localize("DalamudSettingCustomRepoWarning", "We cannot take any responsibility for third-party plugins and repositories.\nTake care when installing third-party plugins from untrusted sources."));
@ -340,7 +348,14 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.Text(repoNumber.ToString()); ImGui.Text(repoNumber.ToString());
ImGui.NextColumn(); ImGui.NextColumn();
ImGui.TextWrapped(thirdRepoSetting.Url); ImGui.SetNextItemWidth(-1);
var url = thirdRepoSetting.Url;
if (ImGui.InputText($"##thirdRepoInput", ref url, 65535, ImGuiInputTextFlags.EnterReturnsTrue))
{
thirdRepoSetting.Url = url;
this.thirdRepoListChanged = url != thirdRepoSetting.Url;
}
ImGui.NextColumn(); ImGui.NextColumn();
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + (ImGui.GetColumnWidth() / 2) - 7 - (12 * ImGuiHelpers.GlobalScale)); ImGui.SetCursorPosX(ImGui.GetCursorPosX() + (ImGui.GetColumnWidth() / 2) - 7 - (12 * ImGuiHelpers.GlobalScale));
@ -352,6 +367,8 @@ namespace Dalamud.Interface.Internal.Windows
repoToRemove = thirdRepoSetting; repoToRemove = thirdRepoSetting;
} }
ImGui.PopID();
ImGui.NextColumn(); ImGui.NextColumn();
ImGui.Separator(); ImGui.Separator();
@ -409,6 +426,14 @@ namespace Dalamud.Interface.Internal.Windows
#region Custom dev plugin load locations #region Custom dev plugin load locations
ImGui.Text(Loc.Localize("DalamudSettingsDevPluginLocation", "Dev Plugin Locations")); ImGui.Text(Loc.Localize("DalamudSettingsDevPluginLocation", "Dev Plugin Locations"));
if (this.devPluginLocationsChanged)
{
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.HealerGreen);
ImGui.SameLine();
ImGui.Text(Loc.Localize("DalamudSettingsChanged", "(Changed)"));
ImGui.PopStyleColor();
}
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingsDevPluginLocationsHint", "Add additional dev plugin load locations.\nThese can be either the directory or DLL path.")); ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingsDevPluginLocationsHint", "Add additional dev plugin load locations.\nThese can be either the directory or DLL path."));
ImGuiHelpers.ScaledDummy(5); ImGuiHelpers.ScaledDummy(5);
@ -445,7 +470,14 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.Text(locNumber.ToString()); ImGui.Text(locNumber.ToString());
ImGui.NextColumn(); ImGui.NextColumn();
ImGui.TextWrapped(devPluginLocationSetting.Path); ImGui.SetNextItemWidth(-1);
var path = devPluginLocationSetting.Path;
if (ImGui.InputText($"##devPluginLocationInput", ref path, 65535, ImGuiInputTextFlags.EnterReturnsTrue))
{
devPluginLocationSetting.Path = path;
this.devPluginLocationsChanged = path != devPluginLocationSetting.Path;
}
ImGui.NextColumn(); ImGui.NextColumn();
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + (ImGui.GetColumnWidth() / 2) - 7 - (12 * ImGuiHelpers.GlobalScale)); ImGui.SetCursorPosX(ImGui.GetCursorPosX() + (ImGui.GetColumnWidth() / 2) - 7 - (12 * ImGuiHelpers.GlobalScale));
@ -457,6 +489,8 @@ namespace Dalamud.Interface.Internal.Windows
locationToRemove = devPluginLocationSetting; locationToRemove = devPluginLocationSetting;
} }
ImGui.PopID();
ImGui.NextColumn(); ImGui.NextColumn();
ImGui.Separator(); ImGui.Separator();
@ -525,6 +559,11 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.SameLine(); ImGui.SameLine();
if (ImGui.Button(Loc.Localize("Close", "Close")))
buttonClose = true;
ImGui.SameLine();
if (ImGui.Button(Loc.Localize("SaveAndClose", "Save and Close"))) if (ImGui.Button(Loc.Localize("SaveAndClose", "Save and Close")))
buttonSave = buttonClose = true; buttonSave = buttonClose = true;
@ -608,6 +647,9 @@ namespace Dalamud.Interface.Internal.Windows
configuration.Save(); configuration.Save();
this.devPluginLocationsChanged = false;
this.thirdRepoListChanged = false;
_ = Service<PluginManager>.Get().ReloadPluginMastersAsync(); _ = Service<PluginManager>.Get().ReloadPluginMastersAsync();
} }
} }