From 97c6ae1aa0eb0c7cd6c4b735f1cd667aa8a60510 Mon Sep 17 00:00:00 2001 From: Johannes Lorenz <1042576+JohannesLorenz@users.noreply.github.com> Date: Sat, 5 Aug 2023 22:20:23 +0200 Subject: [PATCH] Lv2: Improve control visualization (#6799) Previously, the Lv2 controls were checked for control types in this order: integer? enum? toggle? generic? This is bad because it goes from generic (integer) to specific (toggle), and then defaults to most generic. The order should be specific (toggle) to generic (integer, generic), which is fixed by this PR. This solves that controls which are marked "toggle" and "integer" were being displayed as a spinbox (#6798). Additional improvement: Only show search bar for more than 5 controls, previously more than 2 (#6798). --- src/core/lv2/Lv2Ports.cpp | 8 ++++---- src/gui/ControlLayout.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/lv2/Lv2Ports.cpp b/src/core/lv2/Lv2Ports.cpp index 1ce1d6956..2faee067d 100644 --- a/src/core/lv2/Lv2Ports.cpp +++ b/src/core/lv2/Lv2Ports.cpp @@ -114,12 +114,12 @@ std::vector Meta::get(const LilvPlugin *plugin, m_optional = hasProperty(LV2_CORE__connectionOptional); - m_vis = hasProperty(LV2_CORE__integer) - ? Vis::Integer // WARNING: this may still be changed below + m_vis = hasProperty(LV2_CORE__toggled) + ? Vis::Toggled : hasProperty(LV2_CORE__enumeration) ? Vis::Enumeration - : hasProperty(LV2_CORE__toggled) - ? Vis::Toggled + : hasProperty(LV2_CORE__integer) + ? Vis::Integer // WARNING: this may still be changed below : Vis::Generic; if (isA(LV2_CORE__InputPort)) { m_flow = Flow::Input; } diff --git a/src/gui/ControlLayout.cpp b/src/gui/ControlLayout.cpp index 7e0976c94..5e9a21101 100644 --- a/src/gui/ControlLayout.cpp +++ b/src/gui/ControlLayout.cpp @@ -258,8 +258,8 @@ int ControlLayout::doLayout(const QRect &rect, bool testOnly) const if (first) { // for the search bar, only show it if there are at least - // two control widgets (i.e. at least 3 widgets) - if (m_itemMap.size() > 2) { wid->show(); } + // five control widgets (i.e. at least 6 widgets) + if (m_itemMap.size() > 5) { wid->show(); } else { wid->hide(); } } else { wid->show(); }