This commit is contained in:
goat 2021-09-15 02:46:58 +02:00
commit e258dc9ec4
No known key found for this signature in database
GPG key ID: F18F057873895461

View file

@ -167,15 +167,38 @@ namespace Dalamud.Interface.Internal.Windows
/// <inheritdoc/>
public override void Draw()
{
var configuration = Service<DalamudConfiguration>.Get();
var pluginManager = Service<PluginManager>.Get();
var windowSize = ImGui.GetWindowSize();
ImGui.BeginChild("scrolling", new Vector2(windowSize.X - 5 - (5 * ImGuiHelpers.GlobalScale), windowSize.Y - 35 - (35 * ImGuiHelpers.GlobalScale)), false, ImGuiWindowFlags.HorizontalScrollbar);
if (ImGui.BeginTabBar("SetTabBar"))
{
if (ImGui.BeginTabItem(Loc.Localize("DalamudSettingsGeneral", "General")))
{
this.DrawGeneralTab();
ImGui.EndTabItem();
}
if (ImGui.BeginTabItem(Loc.Localize("DalamudSettingsVisual", "Look & Feel")))
{
this.DrawLookAndFeelTab();
ImGui.EndTabItem();
}
if (ImGui.BeginTabItem(Loc.Localize("DalamudSettingsExperimental", "Experimental")))
{
this.DrawExperimentalTab();
ImGui.EndTabItem();
}
ImGui.EndTabBar();
}
ImGui.EndChild();
this.DrawSaveCloseButtons();
}
private void DrawGeneralTab()
{
ImGui.Text(Loc.Localize("DalamudSettingsLanguage", "Language"));
ImGui.Combo("##XlLangCombo", ref this.langIndex, this.locLanguages, this.locLanguages.Length);
@ -215,11 +238,9 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.Checkbox(Loc.Localize("DalamudSettingsSystemMenu", "Dalamud buttons in system menu"), ref this.doButtonsSystemMenu);
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingsSystemMenuMsgHint", "Add buttons for Dalamud plugins and settings to the system menu."));
ImGui.EndTabItem();
}
if (ImGui.BeginTabItem(Loc.Localize("DalamudSettingsVisual", "Look & Feel")))
private void DrawLookAndFeelTab()
{
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + 3);
ImGui.Text(Loc.Localize("DalamudSettingsGlobalUiScale", "Global UI Scale"));
@ -262,12 +283,13 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.Checkbox(Loc.Localize("DalamudSettingToggleGamepadNavigation", "Control plugins via gamepad"), ref this.doGamepad);
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingToggleGamepadNavigationHint", "This will allow you to toggle between game and plugin navigation via L1+L3.\nToggle the PluginInstaller window via R3 if ImGui navigation is enabled."));
ImGui.EndTabItem();
}
if (ImGui.BeginTabItem(Loc.Localize("DalamudSettingsExperimental", "Experimental")))
private void DrawExperimentalTab()
{
var configuration = Service<DalamudConfiguration>.Get();
var pluginManager = Service<PluginManager>.Get();
#region Plugin testing
ImGui.Checkbox(Loc.Localize("DalamudSettingsPluginTest", "Get plugin testing builds"), ref this.doPluginTest);
@ -292,8 +314,17 @@ namespace Dalamud.Interface.Internal.Windows
ImGuiHelpers.ScaledDummy(12);
#region Custom repos
this.DrawCustomReposSection();
ImGuiHelpers.ScaledDummy(12);
this.DrawDevPluginLocationsSection();
ImGuiHelpers.ScaledDummy(12);
}
private void DrawCustomReposSection()
{
ImGui.Text(Loc.Localize("DalamudSettingsCustomRepo", "Custom Plugin Repositories"));
if (this.thirdRepoListChanged)
{
@ -351,10 +382,23 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.SetNextItemWidth(-1);
var url = thirdRepoSetting.Url;
if (ImGui.InputText($"##thirdRepoInput", ref url, 65535, ImGuiInputTextFlags.EnterReturnsTrue))
{
var contains = this.thirdRepoList.Select(repo => repo.Url).Contains(url);
if (thirdRepoSetting.Url == url)
{
// no change.
}
else if (contains && thirdRepoSetting.Url != url)
{
this.thirdRepoAddError = Loc.Localize("DalamudThirdRepoExists", "Repo already exists.");
Task.Delay(5000).ContinueWith(t => this.thirdRepoAddError = string.Empty);
}
else
{
thirdRepoSetting.Url = url;
this.thirdRepoListChanged = url != thirdRepoSetting.Url;
}
}
ImGui.NextColumn();
@ -412,19 +456,14 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.Columns(1);
ImGui.EndTabItem();
if (!string.IsNullOrEmpty(this.thirdRepoAddError))
{
ImGui.TextColored(new Vector4(1, 0, 0, 1), this.thirdRepoAddError);
}
}
#endregion
ImGuiHelpers.ScaledDummy(12);
#region Custom dev plugin load locations
private void DrawDevPluginLocationsSection()
{
ImGui.Text(Loc.Localize("DalamudSettingsDevPluginLocation", "Dev Plugin Locations"));
if (this.devPluginLocationsChanged)
{
@ -466,17 +505,30 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.PushID($"devPluginLocation_{devPluginLocationSetting.Path}");
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + (ImGui.GetColumnWidth() / 2) - 8 - (ImGui.CalcTextSize(repoNumber.ToString()).X / 2));
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + (ImGui.GetColumnWidth() / 2) - 8 - (ImGui.CalcTextSize(locNumber.ToString()).X / 2));
ImGui.Text(locNumber.ToString());
ImGui.NextColumn();
ImGui.SetNextItemWidth(-1);
var path = devPluginLocationSetting.Path;
if (ImGui.InputText($"##devPluginLocationInput", ref path, 65535, ImGuiInputTextFlags.EnterReturnsTrue))
{
var contains = this.devPluginLocations.Select(loc => loc.Path).Contains(path);
if (devPluginLocationSetting.Path == path)
{
// no change.
}
else if (contains && devPluginLocationSetting.Path != path)
{
this.devPluginLocationAddError = Loc.Localize("DalamudDevPluginLocationExists", "Location already exists.");
Task.Delay(5000).ContinueWith(t => this.devPluginLocationAddError = string.Empty);
}
else
{
devPluginLocationSetting.Path = path;
this.devPluginLocationsChanged = path != devPluginLocationSetting.Path;
}
}
ImGui.NextColumn();
@ -534,26 +586,19 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.Columns(1);
ImGui.EndTabItem();
if (!string.IsNullOrEmpty(this.devPluginLocationAddError))
{
ImGui.TextColored(new Vector4(1, 0, 0, 1), this.devPluginLocationAddError);
}
#endregion
ImGuiHelpers.ScaledDummy(12);
}
ImGui.EndTabBar();
}
ImGui.EndChild();
private void DrawSaveCloseButtons()
{
var buttonSave = false;
var buttonClose = false;
var pluginManager = Service<PluginManager>.Get();
if (ImGui.Button(Loc.Localize("Save", "Save")))
buttonSave = true;