Browse Source

Dynamically show knobs in rack view as much as possible

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.1-rc1
falkTX 5 years ago
parent
commit
7925f36d20
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
4 changed files with 89 additions and 13 deletions
  1. +6
    -0
      resources/ui/carla_plugin_calf.ui
  2. +21
    -3
      resources/ui/carla_plugin_default.ui
  3. +15
    -3
      resources/ui/carla_plugin_presets.ui
  4. +47
    -7
      source/frontend/carla_skin.py

+ 6
- 0
resources/ui/carla_plugin_calf.ui View File

@@ -344,6 +344,12 @@
</item>
<item>
<widget class="QWidget" name="w_knobs" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="spacing">
<number>2</number>


+ 21
- 3
resources/ui/carla_plugin_default.ui View File

@@ -114,7 +114,7 @@
<string/>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<iconset>
<normaloff>:/bitmaps/button_gui.png</normaloff>:/bitmaps/button_gui.png</iconset>
</property>
<property name="iconSize">
@@ -149,7 +149,7 @@
<string/>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<iconset>
<normaloff>:/bitmaps/button_edit.png</normaloff>:/bitmaps/button_edit.png</iconset>
</property>
<property name="iconSize">
@@ -426,6 +426,12 @@
</property>
<item>
<widget class="QWidget" name="w_knobs_left" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="margin">
<number>0</number>
@@ -449,7 +455,19 @@
<item>
<widget class="QWidget" name="w_knobs_right" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>12</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>


+ 15
- 3
resources/ui/carla_plugin_presets.ui View File

@@ -111,7 +111,7 @@
<string/>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<iconset>
<normaloff>:/bitmaps/button_gui.png</normaloff>:/bitmaps/button_gui.png</iconset>
</property>
<property name="iconSize">
@@ -146,7 +146,7 @@
<string/>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<iconset>
<normaloff>:/bitmaps/button_edit.png</normaloff>:/bitmaps/button_edit.png</iconset>
</property>
<property name="iconSize">
@@ -431,7 +431,19 @@
<item>
<widget class="QWidget" name="w_knobs_right" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="margin">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>12</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>


+ 47
- 7
source/frontend/carla_skin.py View File

@@ -242,6 +242,8 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):
if self.fPeaksOutputCount > 2:
self.fPeaksOutputCount = 2

self.fAdjustViewableKnobCountScheduled = False

# used during testing
self.fIdleTimerId = 0

@@ -557,14 +559,11 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):
if self.w_knobs_left is not None:
parameterCount = self.host.get_parameter_count(self.fPluginId)

if "calf" in self.fSkinStyle:
maxWidgets = 7
else:
maxWidgets = 8

index = 0
layout = self.w_knobs_left.layout()
for i in range(parameterCount):
if index >= maxWidgets:
# 50 should be enough for everybody, right?
if index >= 50:
break

paramInfo = self.host.get_parameter_info(self.fPluginId, i)
@@ -600,7 +599,7 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):

index += 1
self.fParameterList.append([i, widget])
self.w_knobs_left.layout().addWidget(widget)
layout.addWidget(widget)

if self.w_knobs_right is not None and (self.fPluginInfo['hints'] & PLUGIN_CAN_DRYWET) != 0:
widget = PixmapDial(self, PARAMETER_DRYWET)
@@ -629,11 +628,17 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):
paramWidget.blockSignals(True)
paramWidget.setValue(self.host.get_internal_parameter_value(self.fPluginId, paramIndex))
paramWidget.blockSignals(False)
if paramIndex >= 0:
paramWidget.hide()

# -------------------------------------------------------------

self.setWindowTitle(self.fPluginInfo['name'])

if not self.fAdjustViewableKnobCountScheduled:
self.fAdjustViewableKnobCountScheduled = True
QTimer.singleShot(1, self.adjustViewableKnobCount)

#------------------------------------------------------------------

def getFixedHeight(self):
@@ -1377,6 +1382,35 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):

#------------------------------------------------------------------

def adjustViewableKnobCount(self):
# FIXME Object already destroyed, but timer still kicked in
if self is None:
return

self.fAdjustViewableKnobCountScheduled = False

if self.w_knobs_left is None:
return

for index, widget in self.fParameterList:
if index < 0 or not widget.isVisible():
break
widget.hide()

prevWidth = 0
for index, widget in self.fParameterList:
if index < 0:
break

widget.show()
newWidth = self.w_knobs_left.width()

if newWidth == prevWidth:
widget.hide()
break

prevWidth = newWidth

def testTimer(self):
self.fIdleTimerId = self.startTimer(25)

@@ -1397,6 +1431,12 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):

QFrame.closeEvent(self, event)

def resizeEvent(self, event):
if not self.fAdjustViewableKnobCountScheduled:
self.fAdjustViewableKnobCountScheduled = True
QTimer.singleShot(100, self.adjustViewableKnobCount)
QFrame.resizeEvent(self, event)

def timerEvent(self, event):
if event.timerId() == self.fIdleTimerId:
self.host.engine_idle()


Loading…
Cancel
Save