feat(config): bump schema to v20 with style-refactor visibility fields
Adds MainWindowOpen, SettingsWindowOpen, MaxParallelPopouts (channel popout pool size), TellAutoOpenMode (Off/Sidebar/TopTab/Popout) and SidebarAutoSwitchThresholdPx. Migration is additive — field initializers fill defaults for v19 configs, the Plugin.cs schema gate bumps the version stamp after load. UpdateFrom gets explicit sync statements for all five so settings-save edits do not drop them.
This commit is contained in:
@@ -35,7 +35,7 @@ public class ConfigKeyBind
|
||||
[Serializable]
|
||||
public class Configuration : IPluginConfiguration
|
||||
{
|
||||
private const int LatestVersion = 19;
|
||||
private const int LatestVersion = 20;
|
||||
|
||||
public int Version { get; set; } = LatestVersion;
|
||||
|
||||
@@ -252,6 +252,15 @@ public class Configuration : IPluginConfiguration
|
||||
public ConfigKeyBind? ChatTabForward;
|
||||
public ConfigKeyBind? ChatTabBackward;
|
||||
|
||||
// v20 fields: window visibility state, channel popout pool size and
|
||||
// sidebar auto-switch threshold. All initializers double as the
|
||||
// migration defaults for configs loaded at v19 or earlier.
|
||||
public bool MainWindowOpen = true;
|
||||
public bool SettingsWindowOpen;
|
||||
public int MaxParallelPopouts = 8;
|
||||
public TellAutoOpenMode TellAutoOpenMode = TellAutoOpenMode.Sidebar;
|
||||
public int SidebarAutoSwitchThresholdPx = 800;
|
||||
|
||||
public void UpdateFrom(Configuration other, bool backToOriginal)
|
||||
{
|
||||
if (backToOriginal)
|
||||
@@ -392,9 +401,24 @@ public class Configuration : IPluginConfiguration
|
||||
|
||||
WorldSuffixMode = other.WorldSuffixMode;
|
||||
NameFormMode = other.NameFormMode;
|
||||
|
||||
MainWindowOpen = other.MainWindowOpen;
|
||||
SettingsWindowOpen = other.SettingsWindowOpen;
|
||||
MaxParallelPopouts = other.MaxParallelPopouts;
|
||||
TellAutoOpenMode = other.TellAutoOpenMode;
|
||||
SidebarAutoSwitchThresholdPx = other.SidebarAutoSwitchThresholdPx;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public enum TellAutoOpenMode
|
||||
{
|
||||
Off,
|
||||
Sidebar,
|
||||
TopTab,
|
||||
Popout,
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public enum UnreadMode
|
||||
{
|
||||
|
||||
@@ -200,11 +200,12 @@ public sealed class Plugin : IAsyncDalamudPlugin
|
||||
// do not touch either static, so the brief null-window is safe.
|
||||
|
||||
// Schema gate: v1.4.x+ requires config v16+. Users on older schemas
|
||||
// must install v1.4.2 first to run the migration chain. v19 adds the
|
||||
// must install v1.4.2 first to run the migration chain. v19 added the
|
||||
// top-level CustomSoundVolume, WindowOpacityInactive, WorldSuffixMode
|
||||
// and NameFormMode fields — all additive with defaults, so v16-v18
|
||||
// configs load cleanly and get their Version stamp bumped after the
|
||||
// gate.
|
||||
// and NameFormMode fields; v20 adds MainWindowOpen, SettingsWindowOpen,
|
||||
// MaxParallelPopouts, TellAutoOpenMode and SidebarAutoSwitchThresholdPx
|
||||
// — all additive with defaults, so v16-v19 configs load cleanly and
|
||||
// get their Version stamp bumped after the gate.
|
||||
if (Config.Version < 16)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
@@ -212,7 +213,7 @@ public sealed class Plugin : IAsyncDalamudPlugin
|
||||
+ "Please install v1.4.2 first to migrate the configuration, then upgrade to v1.4.10."
|
||||
);
|
||||
}
|
||||
Config.Version = 19;
|
||||
Config.Version = 20;
|
||||
|
||||
// Unpinned TempTabs are session-only and dropped on every load. Pinned
|
||||
// TempTabs survive reload — Jin's tester feedback (v1.4.7).
|
||||
|
||||
Reference in New Issue
Block a user