Skip to content

Commit

Permalink
alarms UI
Browse files Browse the repository at this point in the history
  • Loading branch information
xorus committed Jan 2, 2024
1 parent a146685 commit a52f39e
Show file tree
Hide file tree
Showing 14 changed files with 674 additions and 116 deletions.
29 changes: 29 additions & 0 deletions Plugin/Attributes/ColorPicker.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// This file is part of EngageTimer
// Copyright (C) 2024 Xorus <xorus@posteo.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

using System;

namespace EngageTimer.Attributes;

[AttributeUsage(AttributeTargets.Property)]
public class ColorPicker : Attribute
{
public readonly int Id;

public ColorPicker(int id)
{
Id = id;
}
}
6 changes: 3 additions & 3 deletions Plugin/Commands/MainCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,20 @@ private void OnCommand(string command, string args)
case "c":
case "countdown":
Plugin.Config.Countdown.Display = ToStatus(argument, Plugin.Config.Countdown.Display);
Plugin.Config.Save();
Plugin.Config.SaveNow();
Plugin.ChatGui.Print(Translator.Tr("MainCommand_Help_Countdown_Success",
StatusStr(Plugin.Config.Countdown.Display)));
break;
case "sw":
case "fw":
Plugin.Config.FloatingWindow.Display = ToStatus(argument, Plugin.Config.FloatingWindow.Display);
Plugin.Config.Save();
Plugin.Config.SaveNow();
Plugin.ChatGui.Print(Translator.Tr("MainCommand_Help_FW_Success",
StatusStr(Plugin.Config.FloatingWindow.Display)));
break;
case "dtr":
Plugin.Config.Dtr.CombatTimeEnabled = ToStatus(argument, Plugin.Config.Dtr.CombatTimeEnabled);
Plugin.Config.Save();
Plugin.Config.SaveNow();
Plugin.ChatGui.Print(Translator.Tr("MainCommand_Help_Dtr_Success",
StatusStr(Plugin.Config.Dtr.CombatTimeEnabled)));
break;
Expand Down
8 changes: 4 additions & 4 deletions Plugin/Configuration/ConfigurationFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public ConfigurationFile()
_saveTimer.Elapsed += SaveTimerElapsed;
}

public void Save()
public void SaveNow()
{
Plugin.Logger.Debug("Saving configuration");
_pluginInterface.SavePluginConfig(this);
Expand All @@ -61,10 +61,10 @@ public void Save()

private void SaveTimerElapsed(object? sender, ElapsedEventArgs e)
{
Save();
SaveNow();
}

public void DebouncedSave()
public void Save()
{
_saveTimer.Stop();
_saveTimer.Start();
Expand Down Expand Up @@ -140,7 +140,7 @@ public ConfigurationFile Import(OldConfig old)
Dtr.CombatTimeEnableHideAfter = old.DtrCombatTimeEnableHideAfter;
Dtr.CombatTimeHideAfter = old.DtrCombatTimeHideAfter;
Version = 3;
Save();
SaveNow();

return this;
}
Expand Down
6 changes: 3 additions & 3 deletions Plugin/Configuration/FloatingWindowConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ public class FloatingWindowConfiguration
[AutoField("Settings_FWTab_PrePullOffset", Components.FieldType.InputFloat, 0.1f, 1f, "%.3fs")]
public float PrePullOffset { get; set; } = .0f;

[AutoField("Settings_FWTab_TextColor")]
[AutoField("Settings_FWTab_TextColor"), ColorPicker(1)]
public Vector4 PrePullColor { get; set; } = ImGuiColors.DalamudRed;

// Stopwatch cosmetics
[AutoField("Settings_FWTab_TextColor")]
[AutoField("Settings_FWTab_TextColor"), ColorPicker(2)]
public Vector4 TextColor { get; set; } = new(255, 255, 255, 1);

[AutoField("Settings_FWTab_BackgroundColor")]
[AutoField("Settings_FWTab_BackgroundColor"), ColorPicker(3)]
public Vector4 BackgroundColor { get; set; } = new(0, 0, 0, 0);

public ConfigurationFile.TextAlign Align { get; set; } = ConfigurationFile.TextAlign.Left;
Expand Down
16 changes: 8 additions & 8 deletions Plugin/Configuration/Legacy/CombatAlarmsConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ public class CombatAlarmsConfiguration
{
public enum TextType
{
DalamudNotification = 0,
GameToast = 1,
ChatLogMessage = 2
ChatLogMessage = 0,
DalamudNotification = 1,
GameToast = 2
}

public class Alarm
{
public bool Enabled = true;
public int StartTime;
public int Duration;
public int StartTime = 270;
public int Duration = 10;
public string? Text;
public Vector4? Color;
public int? Sfx;
public Vector4? Color = new Vector4(.8f, .24f, .24f, 1);
public int? Sfx = 9;
public TextType TextType = TextType.DalamudNotification;
public bool Blink;
public bool Blink = false;
}

public readonly List<Alarm> Alarms = new()
Expand Down
216 changes: 216 additions & 0 deletions Plugin/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a52f39e

Please sign in to comment.