feat: add chat database

This commit is contained in:
Anna
2022-02-13 04:36:08 -05:00
parent 18c311ace5
commit 9b7b84a58d
25 changed files with 476 additions and 95 deletions
+60
View File
@@ -0,0 +1,60 @@
using ChatTwo.Resources;
using ChatTwo.Util;
using ImGuiNET;
namespace ChatTwo.Ui.SettingsTabs;
internal sealed class Database : ISettingsTab {
private Configuration Mutable { get; }
private Store Store { get; }
public string Name => Language.Options_Database_Tab + "###tabs-database";
internal Database(Configuration mutable, Store store) {
this.Store = store;
this.Mutable = mutable;
}
private bool _showAdvanced;
public void Draw(bool changed) {
if (changed) {
this._showAdvanced = ImGui.GetIO().KeyShift;
}
ImGuiUtil.OptionCheckbox(ref this.Mutable.DatabaseBattleMessages, Language.Options_DatabaseBattleMessages_Name, Language.Options_DatabaseBattleMessages_Description);
ImGui.Spacing();
if (ImGuiUtil.OptionCheckbox(ref this.Mutable.LoadPreviousSession, Language.Options_LoadPreviousSession_Name, Language.Options_LoadPreviousSession_Description)) {
if (this.Mutable.LoadPreviousSession) {
this.Mutable.FilterIncludePreviousSessions = true;
}
}
ImGui.Spacing();
if (ImGuiUtil.OptionCheckbox(ref this.Mutable.FilterIncludePreviousSessions, Language.Options_FilterIncludePreviousSessions_Name, Language.Options_FilterIncludePreviousSessions_Description)) {
if (!this.Mutable.FilterIncludePreviousSessions) {
this.Mutable.LoadPreviousSession = false;
}
}
ImGui.Spacing();
if (this._showAdvanced && ImGui.TreeNodeEx("Advanced")) {
ImGui.PushTextWrapPos();
ImGuiUtil.WarningText("Do not click these buttons unless you know what you're doing.");
if (ImGui.Button("Checkpoint")) {
this.Store.Database.Checkpoint();
}
if (ImGui.Button("Rebuild")) {
this.Store.Database.Rebuild();
}
ImGui.PopTextWrapPos();
ImGui.TreePop();
}
}
}