From ae913d80c74387b56171ae74fd1a87547d8c6012 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 25 Jan 2015 04:26:04 +0000 Subject: [PATCH] Rework calf skin a bit, add custom meters; Misc changes to basefx --- resources/bitmaps/button_calf3.png | Bin 0 -> 848 bytes resources/bitmaps/button_calf3_down.png | Bin 0 -> 798 bytes resources/bitmaps/meter_calf_off.png | Bin 0 -> 928 bytes resources/bitmaps/meter_calf_on.png | Bin 0 -> 785 bytes resources/resources.qrc | 5 +- resources/ui/carla_plugin_basic_fx.ui | 181 +++++----- resources/ui/carla_plugin_calf.ui | 455 +++++++++++++----------- source/carla_host.py | 6 +- source/carla_skin.py | 42 ++- source/widgets/digitalpeakmeter.py | 72 +++- 10 files changed, 452 insertions(+), 309 deletions(-) create mode 100644 resources/bitmaps/button_calf3.png create mode 100644 resources/bitmaps/button_calf3_down.png create mode 100644 resources/bitmaps/meter_calf_off.png create mode 100644 resources/bitmaps/meter_calf_on.png diff --git a/resources/bitmaps/button_calf3.png b/resources/bitmaps/button_calf3.png new file mode 100644 index 0000000000000000000000000000000000000000..416d6f19929045812bfb7ed14383c84822ea2ea4 GIT binary patch literal 848 zcmV-W1F!svP)SUzm@#N%$^?LoF1$A+8f$9QNCyNM(a&U0K z(b3U^0$*QWvn85oRXUr^9vpZ!n}L=JTp7cBe!%hZ4*1W%*XZO?tr-y_0(Zl#r<4s= zI)Yl!DjCg>nB>RgJV8d4_xj~;gFTT>1st!#e$$;0-Y1ENhljv< zQ?53-TrNgu@L}3=xvUt$i1Bj4^zkTEexJ|&6M*aa&JjUGaC&;m`-{ubp>Nr5W{6bP zl0g~o6}YW#49nXH@b2AP@QPQ3Gn`K!Ke5@|4H_IGjQ3(t(m+B8*~39bA{7yPj#b$V z`rZgCUXE}G=bsP%(*J;D?u+2})B;Y*xm|-flO_{1@4BRn=8U9Vg<+ex@3D<0 zI&OF=gq6y+@9|P_>&W$)QWZ#CadSi*7XuNrF(e>TLR7!Kml@?!YE0Y;Sbg?Hd-jC4 aZpQyOY>_vb>7h~p0000Q0(5`#R^D>1Xeoj+-i3Inc1CxM_znVeYyz%=>{YzB!e)gkfvbzUN(5y z2=@-B;7X{5m6tW`$P1oF(C|%#&V8jRNf$_lB z+6O+#;7}M>mzOkn34QOu-rgPu2M3ROp%#k;=G|*>A!2~xaL8mbc~s!#a!G+d+N4?h z7rn^E~U+;Ny%e%Oa;I&Vox}oQ>%Z`kespqjC4wzz(1c5j%y$!$an? zMW^UB@U9nC#Ish167M6phBu;mm;sKDkKmpmGNX z>5x>z<0>ud3rbnmR4$~tTKR(hc6y2t`9l)?ot}D@?rf;*3QBM`04D>O&1O_pMNt&g zWr+i%xok~%;W3D|IuA-W15L(6HLSOLD)kY|^N*_ItxgBh?LNYjnKT_pzwJVx?L=Jg z&z1iCD%*A_k>z3rKFSVdF_Kl=_QnEI0w%sW(SpoYdb+(+8@xwntlV_Y2T! c1-DE13FD<%xJcCB(*OVf07*qoM6N<$f@`p6X#fBK literal 0 HcmV?d00001 diff --git a/resources/bitmaps/meter_calf_off.png b/resources/bitmaps/meter_calf_off.png new file mode 100644 index 0000000000000000000000000000000000000000..d06c8401c78f4a766bb40f410ae30f0f7a13c7e9 GIT binary patch literal 928 zcmV;R17G}!P)f&MS_K6)1Pa<4;HtPG?j(n7384@|=$ACX zg4q0n$W!Q1&7muuRqWBL!iq|GCmmnXcjd%!F=OfR0Z z^3gs`7E{V8>ks#+vxMx$85^HGVwzg)ALrbC^f8r9iO*kf@9~F}HY57|g8O?r6iH5a zcE$Ujy+@H0T>bVZyZa-uxa9Iw^YHUc(zrr?HGKMHgEX!=f1a@S#X5nzwfpR+or`-2GriqANrUBVA$i6cNjIv_=#*h-5s7 zR?uOCNJ(Udgkg)w6k~kC&>=D-GKw$+5r>KB3}ytO>AVJE+S!A!1i1!NLRf=XFarqN z`R#6E5D)lnvFP{vpcF3GxGKS+X!8hHT2P8Mi)hOflwy_{W}WLSVOC^-qD~W+WIP-YbXSzJIJ9*ndFRZLl$}dQGVNSDlBRR( z2&?IhJbS&r7tT4HH^lV6M?*|M0U;uvLUO5Qn{czw2{CPhN7VJ9$ zue0X}RA=P~=*-+V6}9{ixn1ckPp}+hndKn=pZo>%9Y>`*1u(h*0000E6loNO;di`%pu>PDxDp3fBkjss_N?Ma?!PL?b5{u4+jp1kMqMXr_+LI z1MXE=yknHkr~gUs^s#);ecB%%)63V`d}bfBucsKjFvQk#JE^_;#Djs`Y`?S(d0FG` znfvrz-NO49vkad!`0M&6CZ9L>_t+DT53lF#xXtAwFB!c38xv170|zI$I$2+gQPQ)@&7yA{&V4kChz158&TBIww|@@zx|FVWbZ zg^1v%4$3nT5yG~O&6nYYy}Mbyh#(3P`Apu;2%`iMMYs5g zD9R9NQ81rYt3ad+Im97|05QaFX&+)$T0v}UjW!O`F8?0SHV* z>;?dMrY6!M0J`B3>IeX5&L_|@0QPK%@APcVM0l$AVsj?ORc!#~>M7dJ0GO#~D67|| zUdyqq9Dv$%7t1ODn3jTOvsYN^VA`ckFx}D)m_g|P%(!#{X1jC_X1C`rxP_Ou9tO#b P00000NkvXXu0mjf=3!Na literal 0 HcmV?d00001 diff --git a/resources/resources.qrc b/resources/resources.qrc index 84b0d1b05..c982b98fd 100644 --- a/resources/resources.qrc +++ b/resources/resources.qrc @@ -59,8 +59,10 @@ bitmaps/background_zynfx.png bitmaps/button_calf1.png bitmaps/button_calf2.png + bitmaps/button_calf3.png bitmaps/button_calf1_down.png bitmaps/button_calf2_down.png + bitmaps/button_calf3_down.png bitmaps/button_calf1_hover.png bitmaps/button_calf2_hover.png bitmaps/button_distrho.png @@ -116,8 +118,9 @@ bitmaps/led_calf_off.png bitmaps/led_calf_on.png - bitmaps/logo_calf.png + bitmaps/meter_calf_off.png + bitmaps/meter_calf_on.png bitmaps/rack_interior_left.png bitmaps/rack_interior_right.png diff --git a/resources/ui/carla_plugin_basic_fx.ui b/resources/ui/carla_plugin_basic_fx.ui index 0297f36f7..8a20da087 100644 --- a/resources/ui/carla_plugin_basic_fx.ui +++ b/resources/ui/carla_plugin_basic_fx.ui @@ -6,7 +6,7 @@ 0 0 - 374 + 338 71 @@ -33,7 +33,7 @@ 0 - + 1 @@ -195,92 +195,99 @@ - - - - 14 - 14 - - - - - 14 - 14 - - - - - - - true - - - - - - - - 14 - 14 - - - - - 14 - 14 - - - - - - - true - - - - - - - - 14 - 14 - - - - - 14 - 14 - - - - - - - true - - - - - - - - 14 - 14 - - - - - 14 - 14 - - - - - - - true + + + 1 - + + + + + 14 + 14 + + + + + 14 + 14 + + + + + + + true + + + + + + + + 14 + 14 + + + + + 14 + 14 + + + + + + + true + + + + + + + + 14 + 14 + + + + + 14 + 14 + + + + + + + true + + + + + + + + 14 + 14 + + + + + 14 + 14 + + + + + + + true + + + + diff --git a/resources/ui/carla_plugin_calf.ui b/resources/ui/carla_plugin_calf.ui index d9b51d540..19d2d8734 100644 --- a/resources/ui/carla_plugin_calf.ui +++ b/resources/ui/carla_plugin_calf.ui @@ -6,8 +6,8 @@ 0 0 - 643 - 68 + 563 + 89 @@ -22,48 +22,63 @@ QFrame::Raised - + + + 2 + - 8 + 3 - 3 + 0 - 8 + 3 - 3 + 2 - - + + - 0 + 3 + + + 10 + + + 10 - + - AUDIO IN + Enable - - Qt::AlignBottom|Qt::AlignHCenter + + true + + + + + + + On/Off - - + + + Qt::Horizontal + + - 150 - 0 + 40 + 20 - + - - - - @@ -81,228 +96,264 @@ - - - 3 + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 0 + + + 4 - + - GUI + MIDI - - true + + Qt::AlignBottom|Qt::AlignHCenter - + + + + 25 + 25 + + + + + 25 + 25 + + - Edit + + + + + 25 + 25 + true + + + + + + 0 + - + - Remove + AUDIO IN + + + Qt::AlignBottom|Qt::AlignHCenter + + + + + + + + 150 + 0 + - - - - - - Qt::Horizontal - - - - 1 - 20 - - - - - - - - 0 - - - - - MIDI - - - Qt::AlignCenter - - - - - - - - 25 - 25 - - - - - 25 - 25 - - - - - - - - 25 - 25 - - - - true - - - - - - Qt::Vertical + + + 0 - - - 1 - 40 - - - + + + + AUDIO OUT + + + Qt::AlignBottom|Qt::AlignHCenter + + + + + + + + 150 + 0 + + + + + - - - + + + 0 - - - - AUDIO OUT - - - Qt::AlignBottom|Qt::AlignHCenter - - - - - - - - 150 - 0 - - - - - - - - - - Qt::Horizontal - - - - 1 - 20 - + + 1 - - - - Qt::Horizontal - - - 40 - 20 - - - + - - + + 0 + + 10 + + + 10 + - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed + + + 3 - - - 10 - 20 - + + 0 - + + + + GUI + + + true + + + + + + + Edit + + + true + + + + + + + Remove + + + + - - - - 71 - 30 - - - - - 71 - 30 - + + + 0 - - - - - :/bitmaps/logo_calf.png - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 2 + + + 4 + + + 0 + + + 0 + + + 0 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + + 71 + 30 + + + + + 71 + 30 + + + + + + + :/bitmaps/logo_calf.png + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + diff --git a/source/carla_host.py b/source/carla_host.py index 5e8fc2d83..2b0d0cdea 100644 --- a/source/carla_host.py +++ b/source/carla_host.py @@ -1244,7 +1244,11 @@ class HostWindow(QMainWindow): showTimePanel = settings.value("ShowTimePanel", True, type=bool) self.ui.act_settings_show_time_panel.setChecked(showTimePanel) - self.ui.panelTime.setVisible(showTimePanel) + + if showTimePanel: + QTimer.singleShot(0, self.ui.panelTime.show) + else: + self.ui.panelTime.hide() showToolbar = settings.value("ShowToolbar", True, type=bool) self.ui.act_settings_show_toolbar.setChecked(showToolbar) diff --git a/source/carla_skin.py b/source/carla_skin.py index 3b003deef..0096ddfef 100644 --- a/source/carla_skin.py +++ b/source/carla_skin.py @@ -275,6 +275,7 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta): self.b_remove.clicked.connect(self.slot_removePlugin) if self.label_name is not None: + self.label_name.setEnabled(self.fIsActive) self.label_name.setText(self.fPluginInfo['name']) if self.label_type is not None: @@ -371,6 +372,9 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta): self.fEditDialog.clearNotes() self.midiActivityChanged(False) + if self.label_name is not None: + self.label_name.setEnabled(self.fIsActive) + # called from rack, checks if param is possible first def setInternalParameter(self, parameterId, value): if parameterId <= PARAMETER_MAX or parameterId >= PARAMETER_NULL: @@ -964,6 +968,9 @@ class PluginSlot_BasicFX(AbstractPluginSlot): self.ui = ui_carla_plugin_basic_fx.Ui_PluginWidget() self.ui.setupUi(self) + if self.fPluginInfo['type'] == PLUGIN_INTERNAL and self.fPluginInfo['label'] == "midifile": + self.fIsCollapsed = True + # ------------------------------------------------------------- # Set-up GUI @@ -1009,6 +1016,9 @@ class PluginSlot_BasicFX(AbstractPluginSlot): QLabel#label_name { color: #BBB; } + QLabel#label_name:disabled { + color: #555; + } """ % (r, g, b, bg)) self.ui.b_enable.setPixmaps(":/bitmaps/button_off.png", ":/bitmaps/button_on.png", ":/bitmaps/button_off.png") @@ -1021,11 +1031,15 @@ class PluginSlot_BasicFX(AbstractPluginSlot): else: self.ui.b_gui.setPixmaps(":/bitmaps/button_gui.png", ":/bitmaps/button_gui_down.png", ":/bitmaps/button_gui_hover.png") - #if self.fIsCollapsed: - #self.ui.w_knobs.hide() - #self.ui.horizontalLayout_2.setContentsMargins(0,0,0,0) - #self.ui.horizontalLayout_2.setSpacing(0) - #self.ui.horizontalLayout_2.SetMaximumSize(0,0) + if self.fIsCollapsed: + self.layout().setAlignment(Qt.AlignCenter) + self.layout().setContentsMargins(2,2,2,0) + self.ui.layout_leds.setContentsMargins(0,4,0,0) + self.ui.w_knobs.hide() + self.ui.w_screws_left.hide() + self.ui.w_screws_right.hide() + self.ui.label_name.setFixedHeight(self.ui.b_enable.height()) + print("TO BOTTOM") # ------------------------------------------------------------- # Set-up parameters @@ -1145,7 +1159,7 @@ class PluginSlot_BasicFX(AbstractPluginSlot): painter.setBrush(Qt.transparent) painter.setPen(QPen(QColor(42, 42, 42), 1)) - painter.drawRect(0, 1, self.width()-1, 79-3) + painter.drawRect(0, 1, self.width()-1, self.getFixedHeight()-3) painter.setPen(QPen(QColor(60, 60, 60), 1)) painter.drawLine(0, 0, self.width(), 0) @@ -1174,7 +1188,7 @@ class PluginSlot_Calf(AbstractPluginSlot): self.fButtonFont.setPointSize(8) # Use black for mono plugins - self.fBackgroundBlack = audioCount['ins'] == 1 + self.fBackgroundBlack = bool("mono" in self.fPluginInfo["label"].lower()) self.fButtonColorOn = QColor( 18, 41, 87) self.fButtonColorOff = QColor(150, 150, 150) @@ -1186,6 +1200,9 @@ class PluginSlot_Calf(AbstractPluginSlot): QLabel#label_name, QLabel#label_audio_in, QLabel#label_audio_out, QLabel#label_midi { color: #BBB; } + QLabel#label_name:disabled { + color: #667; + } PluginSlot_Calf#PluginWidget { background-image: url(:/bitmaps/background_calf_%s.png); background-repeat: repeat-xy; @@ -1193,6 +1210,9 @@ class PluginSlot_Calf(AbstractPluginSlot): } """ % ("black" if self.fBackgroundBlack else "blue")) + self.ui.line.setStyleSheet("* { color: #FF5100; }") + + self.ui.b_enable.setPixmaps(":/bitmaps/button_calf3.png", ":/bitmaps/button_calf3_down.png", ":/bitmaps/button_calf3.png") self.ui.b_gui.setPixmaps(":/bitmaps/button_calf2.png", ":/bitmaps/button_calf2_down.png", ":/bitmaps/button_calf2_hover.png") self.ui.b_edit.setPixmaps(":/bitmaps/button_calf2.png", ":/bitmaps/button_calf2_down.png", ":/bitmaps/button_calf2_hover.png") self.ui.b_remove.setPixmaps(":/bitmaps/button_calf1.png", ":/bitmaps/button_calf1_down.png", ":/bitmaps/button_calf1_hover.png") @@ -1210,6 +1230,9 @@ class PluginSlot_Calf(AbstractPluginSlot): labelFont.setPointSize(10) self.ui.label_name.setFont(labelFont) + self.ui.peak_in.setMeterStyle(DigitalPeakMeter.STYLE_CALF) + self.ui.peak_out.setMeterStyle(DigitalPeakMeter.STYLE_CALF) + if audioCount['ins'] == 0: self.ui.label_audio_in.hide() self.ui.peak_in.hide() @@ -1272,6 +1295,7 @@ class PluginSlot_Calf(AbstractPluginSlot): # ------------------------------------------------------------- + self.b_enable = self.ui.b_enable self.b_gui = self.ui.b_gui self.b_edit = self.ui.b_edit self.b_remove = self.ui.b_remove @@ -1279,6 +1303,8 @@ class PluginSlot_Calf(AbstractPluginSlot): self.label_name = self.ui.label_name self.led_midi = self.ui.led_midi + self.line = self.ui.line + self.peak_in = self.ui.peak_in self.peak_out = self.ui.peak_out @@ -1291,7 +1317,7 @@ class PluginSlot_Calf(AbstractPluginSlot): #------------------------------------------------------------------ def getFixedHeight(self): - return 88 + return 94 if max(self.peak_in.channelCount(), self.peak_out.channelCount()) < 2 else 106 #------------------------------------------------------------------ diff --git a/source/widgets/digitalpeakmeter.py b/source/widgets/digitalpeakmeter.py index 71a96089d..cbd2c120b 100644 --- a/source/widgets/digitalpeakmeter.py +++ b/source/widgets/digitalpeakmeter.py @@ -26,11 +26,11 @@ from carla_config import * if config_UseQt5: from PyQt5.QtCore import qCritical, Qt, QTimer, QSize - from PyQt5.QtGui import QColor, QLinearGradient, QPainter, QPen + from PyQt5.QtGui import QColor, QLinearGradient, QPainter, QPen, QPixmap from PyQt5.QtWidgets import QWidget else: from PyQt4.QtCore import qCritical, Qt, QTimer, QSize - from PyQt4.QtGui import QColor, QLinearGradient, QPainter, QPen, QWidget + from PyQt4.QtGui import QColor, QLinearGradient, QPainter, QPen, QPixmap, QWidget # ------------------------------------------------------------------------------------------------------------ # Widget Class @@ -48,6 +48,7 @@ class DigitalPeakMeter(QWidget): STYLE_DEFAULT = 1 STYLE_OPENAV = 2 STYLE_RNCBC = 3 + STYLE_CALF = 4 # -------------------------------------------------------------------------------------------------------- @@ -71,6 +72,7 @@ class DigitalPeakMeter(QWidget): self.fMeterBackground = QColor("#070707") self.fMeterGradient = QLinearGradient(0, 0, 0, 0) + self.fMeterPixmaps = () self.fSmoothMultiplier = 2 @@ -96,6 +98,13 @@ class DigitalPeakMeter(QWidget): self.fChannelData.append(0.0) self.fLastChannelData.append(0.0) + if self.fMeterStyle == self.STYLE_CALF: + if self.fChannelCount > 0: + self.setFixedSize(100, 12*self.fChannelCount) + else: + self.setMinimumSize(0, 0) + self.setMaximumSize(9999, 9999) + # -------------------------------------------------------------------------------------------------------- def meterColor(self): @@ -155,7 +164,7 @@ class DigitalPeakMeter(QWidget): if self.fMeterStyle == style: return - if style not in (self.STYLE_DEFAULT, self.STYLE_OPENAV, self.STYLE_RNCBC): + if style not in (self.STYLE_DEFAULT, self.STYLE_OPENAV, self.STYLE_RNCBC, self.STYLE_CALF): return qCritical("DigitalPeakMeter::setMeterStyle(%i) - invalid style" % style) if style == self.STYLE_DEFAULT: @@ -164,6 +173,17 @@ class DigitalPeakMeter(QWidget): self.fMeterBackground = QColor("#1A1A1A") elif style == self.STYLE_RNCBC: self.fMeterBackground = QColor("#070707") + elif style == self.STYLE_CALF: + self.fMeterBackground = QColor("#000") + + if style == self.STYLE_CALF: + self.fMeterPixmaps = (QPixmap(":/bitmaps/meter_calf_off.png"), QPixmap(":/bitmaps/meter_calf_on.png")) + if self.fChannelCount > 0: + self.setFixedSize(100, 12*self.fChannelCount) + else: + self.fMeterPixmaps = () + self.setMinimumSize(0, 0) + self.setMaximumSize(9999, 9999) self.fMeterStyle = style @@ -235,10 +255,6 @@ class DigitalPeakMeter(QWidget): self.fMeterGradient.setColorAt(0.8, self.fMeterColorBase) self.fMeterGradient.setColorAt(1.0, self.fMeterColorBase) - elif self.fMeterStyle == self.STYLE_OPENAV: - self.fMeterGradient.setColorAt(0.0, self.fMeterColorBase) - self.fMeterGradient.setColorAt(1.0, self.fMeterColorBase) - elif self.fMeterStyle == self.STYLE_RNCBC: if self.fMeterColor == self.COLOR_BLUE: c1 = QColor(40,160,160) @@ -265,6 +281,10 @@ class DigitalPeakMeter(QWidget): self.fMeterGradient.setColorAt(0.8, c1) self.fMeterGradient.setColorAt(1.0, c1) + elif self.fMeterStyle in (self.STYLE_OPENAV, self.STYLE_CALF): + self.fMeterGradient.setColorAt(0.0, self.fMeterColorBase) + self.fMeterGradient.setColorAt(1.0, self.fMeterColorBase) + self.updateGrandientFinalStop() def updateGrandientFinalStop(self): @@ -284,7 +304,38 @@ class DigitalPeakMeter(QWidget): # -------------------------------------------------------------------------------------------------------- + def drawCalf(self, event): + painter = QPainter(self) + event.accept() + + # no channels, draw black + if self.fChannelCount == 0: + painter.setPen(QPen(Qt.black, 2)) + painter.setBrush(Qt.black) + painter.drawRect(0, 0, self.width(), self.height()) + return + + for i in range(self.fChannelCount): + painter.drawPixmap(0, 12*i, self.fMeterPixmaps[0]) + + meterPos = 4 + meterSize = 12 + + # draw levels + for level in self.fChannelData: + if level == 0.0: + meterPos += meterSize + continue + + blevel = int(level*26.0)*3 + + painter.drawPixmap(5, meterPos, blevel, 4, self.fMeterPixmaps[1], 0, 0, blevel, 4) + meterPos += meterSize + def paintEvent(self, event): + if self.fMeterStyle == self.STYLE_CALF: + return self.drawCalf(event) + painter = QPainter(self) event.accept() @@ -304,9 +355,6 @@ class DigitalPeakMeter(QWidget): meterSize = (height if self.fMeterOrientation == self.HORIZONTAL else width)/self.fChannelCount # set pen/brush for levels - painter.setPen(QPen(self.fMeterBackground, 0)) - painter.setBrush(self.fMeterGradient) - if self.fMeterStyle == self.STYLE_OPENAV: colorTrans = QColor(self.fMeterColorBase) colorTrans.setAlphaF(0.5) @@ -316,6 +364,10 @@ class DigitalPeakMeter(QWidget): meterPad += 2 meterSize -= 2 + else: + painter.setPen(QPen(self.fMeterBackground, 0)) + painter.setBrush(self.fMeterGradient) + # draw levels for level in self.fChannelData: if level == 0.0: