mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-23 00:49:17 +01:00
Merge pull request #275 from kalilistic/log-settings
add open log at startup and persistent log settings
This commit is contained in:
commit
fc0e89cd09
3 changed files with 22 additions and 5 deletions
|
|
@ -34,6 +34,8 @@ namespace Dalamud
|
||||||
|
|
||||||
public bool PrintPluginsWelcomeMsg { get; set; } = true;
|
public bool PrintPluginsWelcomeMsg { get; set; } = true;
|
||||||
public bool AutoUpdatePlugins { get; set; } = false;
|
public bool AutoUpdatePlugins { get; set; } = false;
|
||||||
|
public bool LogAutoScroll { get; set; } = true;
|
||||||
|
public bool LogOpenAtStartup { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string ConfigPath;
|
public string ConfigPath;
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,9 @@ namespace Dalamud.Interface
|
||||||
|
|
||||||
public DalamudInterface(Dalamud dalamud) {
|
public DalamudInterface(Dalamud dalamud) {
|
||||||
this.dalamud = dalamud;
|
this.dalamud = dalamud;
|
||||||
|
if (dalamud.Configuration.LogOpenAtStartup) {
|
||||||
|
OpenLog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool isImguiDrawDemoWindow = false;
|
private bool isImguiDrawDemoWindow = false;
|
||||||
|
|
@ -97,7 +100,7 @@ namespace Dalamud.Interface
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
if (ImGui.MenuItem("Open Log window"))
|
if (ImGui.MenuItem("Open Log window"))
|
||||||
{
|
{
|
||||||
this.logWindow = new DalamudLogWindow(this.dalamud.CommandManager);
|
this.logWindow = new DalamudLogWindow(this.dalamud.CommandManager, this.dalamud.Configuration);
|
||||||
this.isImguiDrawLogWindow = true;
|
this.isImguiDrawLogWindow = true;
|
||||||
}
|
}
|
||||||
if (ImGui.BeginMenu("Set log level..."))
|
if (ImGui.BeginMenu("Set log level..."))
|
||||||
|
|
@ -336,7 +339,7 @@ namespace Dalamud.Interface
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenLog() {
|
public void OpenLog() {
|
||||||
this.logWindow = new DalamudLogWindow(this.dalamud.CommandManager);
|
this.logWindow = new DalamudLogWindow(this.dalamud.CommandManager, this.dalamud.Configuration);
|
||||||
this.isImguiDrawLogWindow = true;
|
this.isImguiDrawLogWindow = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,15 +13,20 @@ namespace Dalamud.Interface
|
||||||
{
|
{
|
||||||
class DalamudLogWindow : IDisposable {
|
class DalamudLogWindow : IDisposable {
|
||||||
private readonly CommandManager commandManager;
|
private readonly CommandManager commandManager;
|
||||||
private bool autoScroll = true;
|
private readonly DalamudConfiguration configuration;
|
||||||
|
private bool autoScroll;
|
||||||
|
private bool openAtStartup;
|
||||||
private readonly List<(string line, Vector4 color)> logText = new List<(string line, Vector4 color)>();
|
private readonly List<(string line, Vector4 color)> logText = new List<(string line, Vector4 color)>();
|
||||||
|
|
||||||
private readonly object renderLock = new object();
|
private readonly object renderLock = new object();
|
||||||
|
|
||||||
private string commandText = string.Empty;
|
private string commandText = string.Empty;
|
||||||
|
|
||||||
public DalamudLogWindow(CommandManager commandManager) {
|
public DalamudLogWindow(CommandManager commandManager, DalamudConfiguration configuration) {
|
||||||
this.commandManager = commandManager;
|
this.commandManager = commandManager;
|
||||||
|
this.configuration = configuration;
|
||||||
|
this.autoScroll = configuration.LogAutoScroll;
|
||||||
|
this.openAtStartup = configuration.LogOpenAtStartup;
|
||||||
SerilogEventSink.Instance.OnLogLine += Serilog_OnLogLine;
|
SerilogEventSink.Instance.OnLogLine += Serilog_OnLogLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,7 +76,14 @@ namespace Dalamud.Interface
|
||||||
// Options menu
|
// Options menu
|
||||||
if (ImGui.BeginPopup("Options"))
|
if (ImGui.BeginPopup("Options"))
|
||||||
{
|
{
|
||||||
ImGui.Checkbox("Auto-scroll", ref this.autoScroll);
|
if (ImGui.Checkbox("Auto-scroll", ref this.autoScroll)) {
|
||||||
|
this.configuration.LogAutoScroll = this.autoScroll;
|
||||||
|
this.configuration.Save();
|
||||||
|
};
|
||||||
|
if (ImGui.Checkbox("Open at startup", ref this.openAtStartup)) {
|
||||||
|
this.configuration.LogOpenAtStartup = this.openAtStartup;
|
||||||
|
this.configuration.Save();
|
||||||
|
};
|
||||||
ImGui.EndPopup();
|
ImGui.EndPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue