-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Add firstWindowPreference value for layout only #19341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| <value>Open windows from a previous session (layout and content)</value> | ||
| <comment>An option to choose from for the "First window preference" setting. Reopen the layouts from the last session and preserve the content.</comment> | ||
| </data> | ||
| <data name="Globals_FirstWindowPreferencePersistedLayout.Content" xml:space="preserve"> | ||
| <value>Open windows from a previous session (layout only)</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's workshop these names before we send them off to the loc team ;P
| // We just need to detect if the legacy value was used and mark it for fixup, if so. | ||
| if (const auto firstWindowPreferenceValue = json[FirstWindowPreferenceKey.data()]) | ||
| { | ||
| _fixupsAppliedDuringLoad |= firstWindowPreferenceValue == LegacyPersistedWindowLayout.data(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh wow - we've never done a fixup for a legacy key like this!
| <comment>An option to choose from for the "First window preference" setting. Reopen the layouts from the last session.</comment> | ||
| </data> | ||
| <data name="Globals_FirstWindowPreferencePersistedLayoutAndContent.Content" xml:space="preserve"> | ||
| <value>Open windows from a previous session (layout and content)</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe "Restore window layout" and "Restore window layout and content"
Summary of the Pull Request
Updates the "firstWindowPreference" global setting to take 3 values: "defaultProfile", "persistedLayout", and "persistedLayoutAndContent".
The legacy "persistedWindowLayout" is being interpreted as "persistedLayoutAndContent".
The tricky part here is that we need to maintain support for the legacy value as persisting the layout and content, even though the value's name suggests that it should just support the layout and no content. To get around this, I added "persistedLayout" and "persistedLayoutAndContent".
The enum map is manually constructed for
FirstWindowPreferenceto exclude the deprecated value. This prevents the legacy value from leaking into the settings UI.Functionally, the change to serialize the contents is simple.
WindowEmperor::_persistState()'s second parameter is used to serialize the buffer. Rather than having it set totrue, we set it toGlobalSettings().FirstWindowPreference() == FirstWindowPreference::PersistedLayoutAndContent.Validation Steps Performed
✅ "persistedWindowLayout" is changed to "persistedLayoutAndContent"
Closes #18757