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: Removed timestamp from AutoMod messages. (#3503)
- Minor: Added ability to copy message ID with `Shift + Right Click`. (#3481) - Minor: Added ability to copy message ID with `Shift + Right Click`. (#3481)
- Minor: Colorize the entire split header when focused. (#3379) - 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: Fix Split Input hotkeys not being available when input is hidden (#3362)
- Bugfix: Fixed colored usernames sometimes not working. (#3170) - Bugfix: Fixed colored usernames sometimes not working. (#3170)
- Bugfix: Restored ability to send duplicate `/me` messages. (#3166) - Bugfix: Restored ability to send duplicate `/me` messages. (#3166)

View file

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

View file

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