Make Tab Layout setting only accept predefined values (#3564)

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
Mm2PL 2022-02-12 12:27:25 +00:00 committed by GitHub
parent 092f66dc15
commit b2fa7b1d94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 25 deletions

View file

@ -53,6 +53,7 @@
- Minor: Removed timestamp from AutoMod messages. (#3503)
- Minor: Added ability to copy message ID with `Shift + Right Click`. (#3481)
- Minor: Colorize the entire split header when focused. (#3379)
- Minor: Make Tab Layout setting only accept predefined values (#3564)
- Bugfix: Fix Split Input hotkeys not being available when input is hidden (#3362)
- Bugfix: Fixed colored usernames sometimes not working. (#3170)
- Bugfix: Restored ability to send duplicate `/me` messages. (#3166)

View file

@ -98,8 +98,8 @@ public:
"/appearance/messages/usernameDisplayMode",
UsernameDisplayMode::UsernameAndLocalizedName};
IntSetting tabDirection = {"/appearance/tabDirection",
NotebookTabDirection::Horizontal};
EnumSetting<NotebookTabDirection> tabDirection = {
"/appearance/tabDirection", NotebookTabDirection::Horizontal};
// BoolSetting collapseLongMessages =
// {"/appearance/messages/collapseLongMessages", false};

View file

@ -144,30 +144,34 @@ void GeneralPage::initLayout(GeneralPageView &layout)
[](auto args) {
return fuzzyToFloat(args.value, 1.f);
});
layout.addDropdown<int>(
"Tab layout", {"Horizontal", "Vertical"}, s.tabDirection,
[](auto val) {
switch (val)
{
case NotebookTabDirection::Horizontal:
return "Horizontal";
case NotebookTabDirection::Vertical:
return "Vertical";
}
ComboBox *tabDirectionDropdown =
layout.addDropdown<std::underlying_type<NotebookTabDirection>::type>(
"Tab layout", {"Horizontal", "Vertical"}, s.tabDirection,
[](auto val) {
switch (val)
{
case NotebookTabDirection::Horizontal:
return "Horizontal";
case NotebookTabDirection::Vertical:
return "Vertical";
}
return "";
},
[](auto args) {
if (args.value == "Vertical")
{
return NotebookTabDirection::Vertical;
}
else
{
// default to horizontal
return NotebookTabDirection::Horizontal;
}
});
return "";
},
[](auto args) {
if (args.value == "Vertical")
{
return NotebookTabDirection::Vertical;
}
else
{
// default to horizontal
return NotebookTabDirection::Horizontal;
}
},
false);
tabDirectionDropdown->setMinimumWidth(
tabDirectionDropdown->minimumSizeHint().width());
layout.addCheckbox("Show tab close button", s.showTabCloseButton);
layout.addCheckbox("Always on top", s.windowTopMost);