55 lines
1.6 KiB
C#
55 lines
1.6 KiB
C#
using Dalamud.Interface.Utility;
|
|
using EorzeaVotes.Config;
|
|
using EorzeaVotes.Utilities;
|
|
using ImGuiNET;
|
|
|
|
namespace EorzeaVotes.Ui.Tabs;
|
|
|
|
internal class SettingsTab {
|
|
private Plugin Plugin { get; }
|
|
|
|
internal SettingsTab(Plugin plugin) {
|
|
this.Plugin = plugin;
|
|
}
|
|
|
|
internal void Draw(bool forceOpen) {
|
|
if (!ImGuiHelper.BeginTabItem("Settings", forceOpen)) {
|
|
return;
|
|
}
|
|
|
|
using var endTabItem = new OnDispose(ImGui.EndTabItem);
|
|
|
|
ImGuiHelpers.CenteredText("Options");
|
|
|
|
var anyChanged = false;
|
|
|
|
anyChanged |= ImGui.Checkbox("Open window when a new question is available", ref this.Plugin.Config.OpenWhenNew);
|
|
using (ImGuiHelper.WithDisabledColour()) {
|
|
ImGui.TextUnformatted("The window will not open until you are not busy in most cases (not in combat, not in instance, etc.).");
|
|
}
|
|
|
|
anyChanged |= ImGuiHelper.VerticalInput(
|
|
"Check for new questions every",
|
|
label => ImGui.SliderInt(
|
|
label,
|
|
ref this.Plugin.Config.CheckFrequency,
|
|
Configuration.MinFreq,
|
|
Configuration.MaxFreq,
|
|
"%i second(s)"
|
|
)
|
|
);
|
|
|
|
ImGuiHelpers.CenteredText("Optional questions");
|
|
|
|
ImGui.Spacing();
|
|
ImGui.TextUnformatted("These are optional questions that will be sent with every vote you cast. They are used to display breakdowns in the details window for each question.");
|
|
ImGui.Spacing();
|
|
|
|
anyChanged |= this.Plugin.Ui.DrawOptionalQuestions();
|
|
|
|
if (anyChanged) {
|
|
this.Plugin.SaveConfig();
|
|
}
|
|
}
|
|
}
|