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
+1 -1
View File
@@ -29,7 +29,7 @@ internal sealed class About : ISettingsTab {
this._translators.Sort((a, b) => string.Compare(a.ToLowerInvariant(), b.ToLowerInvariant(), StringComparison.Ordinal));
}
public void Draw() {
public void Draw(bool changed) {
ImGui.PushTextWrapPos();
ImGui.TextUnformatted(string.Format(Language.Options_About_Opening, Plugin.PluginName));
+1 -1
View File
@@ -32,7 +32,7 @@ internal sealed class ChatColours : ISettingsTab {
#endif
}
public void Draw() {
public void Draw(bool changed) {
foreach (var (_, types) in ChatTypeExt.SortOrder) {
foreach (var type in types) {
if (ImGuiUtil.IconButton(FontAwesomeIcon.UndoAlt, $"{type}", Language.Options_ChatColours_Reset)) {
+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();
}
}
}
+1 -1
View File
@@ -13,7 +13,7 @@ internal sealed class Display : ISettingsTab {
this.Mutable = mutable;
}
public void Draw() {
public void Draw(bool changed) {
ImGui.PushTextWrapPos();
ImGuiUtil.OptionCheckbox(ref this.Mutable.HideChat, Language.Options_HideChat_Name, Language.Options_HideChat_Description);
+2 -2
View File
@@ -21,8 +21,8 @@ public class Fonts : ISettingsTab {
this.JpFonts = Ui.Fonts.GetJpFonts();
}
public void Draw() {
if (ImGui.IsWindowAppearing()) {
public void Draw(bool changed) {
if (changed) {
this.UpdateFonts();
}
+1 -1
View File
@@ -2,5 +2,5 @@
internal interface ISettingsTab {
string Name { get; }
void Draw();
void Draw(bool changed);
}
+1 -1
View File
@@ -13,7 +13,7 @@ internal sealed class Miscellaneous : ISettingsTab {
this.Mutable = mutable;
}
public void Draw() {
public void Draw(bool changed) {
if (ImGuiUtil.BeginComboVertical(Language.Options_Language_Name, this.Mutable.LanguageOverride.Name())) {
foreach (var language in Enum.GetValues<LanguageOverride>()) {
if (ImGui.Selectable(language.Name())) {
+1 -1
View File
@@ -17,7 +17,7 @@ internal sealed class Tabs : ISettingsTab {
this.Mutable = mutable;
}
public void Draw() {
public void Draw(bool changed) {
const string addTabPopup = "add-tab-popup";
if (ImGuiUtil.IconButton(FontAwesomeIcon.Plus, tooltip: Language.Options_Tabs_Add)) {