| @@ -98,6 +98,7 @@ UIs = \ | |||
| source/ui_carla_edit.py \ | |||
| source/ui_carla_host.py \ | |||
| source/ui_carla_parameter.py \ | |||
| source/ui_carla_plugin_basic_fx.py \ | |||
| source/ui_carla_plugin_default.py \ | |||
| source/ui_carla_plugin_calf.py \ | |||
| source/ui_carla_plugin_zita.py \ | |||
| @@ -48,6 +48,7 @@ | |||
| <file>bitmaps/carla_about.png</file> | |||
| <file>bitmaps/background_calf.png</file> | |||
| <file>bitmaps/background_noise1.png</file> | |||
| <file>bitmaps/background_zynfx.png</file> | |||
| <file>bitmaps/button_calf1.png</file> | |||
| <file>bitmaps/button_calf2.png</file> | |||
| @@ -108,7 +108,7 @@ | |||
| </spacer> | |||
| </item> | |||
| <item> | |||
| <widget class="PixmapDial" name="dial_vol"> | |||
| <widget class="PixmapDial" name="dial_drywet"> | |||
| <property name="minimumSize"> | |||
| <size> | |||
| <width>34</width> | |||
| @@ -125,10 +125,10 @@ | |||
| <enum>Qt::CustomContextMenu</enum> | |||
| </property> | |||
| <property name="statusTip"> | |||
| <string>Output volume (100%)</string> | |||
| <string>Output dry/wet (100%)</string> | |||
| </property> | |||
| <property name="maximum"> | |||
| <number>1270</number> | |||
| <number>1000</number> | |||
| </property> | |||
| <property name="value"> | |||
| <number>1000</number> | |||
| @@ -136,7 +136,7 @@ | |||
| </widget> | |||
| </item> | |||
| <item> | |||
| <widget class="PixmapDial" name="dial_drywet"> | |||
| <widget class="PixmapDial" name="dial_vol"> | |||
| <property name="minimumSize"> | |||
| <size> | |||
| <width>34</width> | |||
| @@ -153,10 +153,10 @@ | |||
| <enum>Qt::CustomContextMenu</enum> | |||
| </property> | |||
| <property name="statusTip"> | |||
| <string>Output dry/wet (100%)</string> | |||
| <string>Output volume (100%)</string> | |||
| </property> | |||
| <property name="maximum"> | |||
| <number>1000</number> | |||
| <number>1270</number> | |||
| </property> | |||
| <property name="value"> | |||
| <number>1000</number> | |||
| @@ -0,0 +1,415 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <ui version="4.0"> | |||
| <class>PluginWidget</class> | |||
| <widget class="QFrame" name="PluginWidget"> | |||
| <property name="contextMenuPolicy"> | |||
| <enum>Qt::CustomContextMenu</enum> | |||
| </property> | |||
| <property name="windowTitle"> | |||
| <string>Frame</string> | |||
| </property> | |||
| <layout class="QVBoxLayout" name="verticalLayout"> | |||
| <property name="spacing"> | |||
| <number>1</number> | |||
| </property> | |||
| <property name="leftMargin"> | |||
| <number>2</number> | |||
| </property> | |||
| <property name="topMargin"> | |||
| <number>1</number> | |||
| </property> | |||
| <property name="rightMargin"> | |||
| <number>2</number> | |||
| </property> | |||
| <property name="bottomMargin"> | |||
| <number>0</number> | |||
| </property> | |||
| <item> | |||
| <layout class="QHBoxLayout" name="horizontalLayout"> | |||
| <property name="spacing"> | |||
| <number>1</number> | |||
| </property> | |||
| <item> | |||
| <spacer name="horizontalSpacer_4"> | |||
| <property name="orientation"> | |||
| <enum>Qt::Horizontal</enum> | |||
| </property> | |||
| <property name="sizeType"> | |||
| <enum>QSizePolicy::Fixed</enum> | |||
| </property> | |||
| <property name="sizeHint" stdset="0"> | |||
| <size> | |||
| <width>20</width> | |||
| <height>1</height> | |||
| </size> | |||
| </property> | |||
| </spacer> | |||
| </item> | |||
| <item> | |||
| <widget class="PixmapButton" name="b_enable"> | |||
| <property name="minimumSize"> | |||
| <size> | |||
| <width>24</width> | |||
| <height>24</height> | |||
| </size> | |||
| </property> | |||
| <property name="maximumSize"> | |||
| <size> | |||
| <width>24</width> | |||
| <height>24</height> | |||
| </size> | |||
| </property> | |||
| <property name="text"> | |||
| <string/> | |||
| </property> | |||
| <property name="icon"> | |||
| <iconset resource="../resources.qrc"> | |||
| <normaloff>:/bitmaps/button_off.png</normaloff>:/bitmaps/button_off.png</iconset> | |||
| </property> | |||
| <property name="iconSize"> | |||
| <size> | |||
| <width>24</width> | |||
| <height>24</height> | |||
| </size> | |||
| </property> | |||
| <property name="checkable"> | |||
| <bool>true</bool> | |||
| </property> | |||
| <property name="flat"> | |||
| <bool>true</bool> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| <item> | |||
| <widget class="PixmapButton" name="b_gui"> | |||
| <property name="minimumSize"> | |||
| <size> | |||
| <width>24</width> | |||
| <height>24</height> | |||
| </size> | |||
| </property> | |||
| <property name="maximumSize"> | |||
| <size> | |||
| <width>24</width> | |||
| <height>24</height> | |||
| </size> | |||
| </property> | |||
| <property name="text"> | |||
| <string/> | |||
| </property> | |||
| <property name="icon"> | |||
| <iconset resource="../resources.qrc"> | |||
| <normaloff>:/bitmaps/button_gui.png</normaloff>:/bitmaps/button_gui.png</iconset> | |||
| </property> | |||
| <property name="iconSize"> | |||
| <size> | |||
| <width>24</width> | |||
| <height>24</height> | |||
| </size> | |||
| </property> | |||
| <property name="checkable"> | |||
| <bool>true</bool> | |||
| </property> | |||
| <property name="flat"> | |||
| <bool>true</bool> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| <item> | |||
| <widget class="PixmapButton" name="b_edit"> | |||
| <property name="minimumSize"> | |||
| <size> | |||
| <width>24</width> | |||
| <height>24</height> | |||
| </size> | |||
| </property> | |||
| <property name="maximumSize"> | |||
| <size> | |||
| <width>24</width> | |||
| <height>24</height> | |||
| </size> | |||
| </property> | |||
| <property name="text"> | |||
| <string/> | |||
| </property> | |||
| <property name="icon"> | |||
| <iconset resource="../resources.qrc"> | |||
| <normaloff>:/bitmaps/button_edit.png</normaloff>:/bitmaps/button_edit.png</iconset> | |||
| </property> | |||
| <property name="iconSize"> | |||
| <size> | |||
| <width>24</width> | |||
| <height>24</height> | |||
| </size> | |||
| </property> | |||
| <property name="checkable"> | |||
| <bool>true</bool> | |||
| </property> | |||
| <property name="flat"> | |||
| <bool>true</bool> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| <item> | |||
| <spacer name="horizontalSpacer"> | |||
| <property name="orientation"> | |||
| <enum>Qt::Horizontal</enum> | |||
| </property> | |||
| <property name="sizeHint" stdset="0"> | |||
| <size> | |||
| <width>40</width> | |||
| <height>20</height> | |||
| </size> | |||
| </property> | |||
| </spacer> | |||
| </item> | |||
| <item> | |||
| <widget class="QLabel" name="label_name"> | |||
| <property name="text"> | |||
| <string>PluginName</string> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| <item> | |||
| <spacer name="horizontalSpacer_2"> | |||
| <property name="orientation"> | |||
| <enum>Qt::Horizontal</enum> | |||
| </property> | |||
| <property name="sizeHint" stdset="0"> | |||
| <size> | |||
| <width>40</width> | |||
| <height>20</height> | |||
| </size> | |||
| </property> | |||
| </spacer> | |||
| </item> | |||
| <item> | |||
| <widget class="QLabel" name="label_type"> | |||
| <property name="text"> | |||
| <string>TYPE</string> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| <item> | |||
| <spacer name="horizontalSpacer_5"> | |||
| <property name="orientation"> | |||
| <enum>Qt::Horizontal</enum> | |||
| </property> | |||
| <property name="sizeType"> | |||
| <enum>QSizePolicy::Fixed</enum> | |||
| </property> | |||
| <property name="sizeHint" stdset="0"> | |||
| <size> | |||
| <width>20</width> | |||
| <height>1</height> | |||
| </size> | |||
| </property> | |||
| </spacer> | |||
| </item> | |||
| </layout> | |||
| </item> | |||
| <item> | |||
| <widget class="Line" name="line"> | |||
| <property name="lineWidth"> | |||
| <number>0</number> | |||
| </property> | |||
| <property name="midLineWidth"> | |||
| <number>1</number> | |||
| </property> | |||
| <property name="orientation"> | |||
| <enum>Qt::Horizontal</enum> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| <item> | |||
| <layout class="QHBoxLayout" name="horizontalLayout_2"> | |||
| <property name="spacing"> | |||
| <number>10</number> | |||
| </property> | |||
| <property name="topMargin"> | |||
| <number>2</number> | |||
| </property> | |||
| <item> | |||
| <widget class="QWidget" name="w_screws_left" native="true"> | |||
| <property name="minimumSize"> | |||
| <size> | |||
| <width>20</width> | |||
| <height>0</height> | |||
| </size> | |||
| </property> | |||
| <property name="maximumSize"> | |||
| <size> | |||
| <width>20</width> | |||
| <height>16777215</height> | |||
| </size> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| <item> | |||
| <widget class="QWidget" name="w_knobs" native="true"> | |||
| <layout class="QHBoxLayout" name="horizontalLayout_3"/> | |||
| </widget> | |||
| </item> | |||
| <item> | |||
| <spacer name="horizontalSpacer_3"> | |||
| <property name="orientation"> | |||
| <enum>Qt::Horizontal</enum> | |||
| </property> | |||
| <property name="sizeHint" stdset="0"> | |||
| <size> | |||
| <width>40</width> | |||
| <height>20</height> | |||
| </size> | |||
| </property> | |||
| </spacer> | |||
| </item> | |||
| <item> | |||
| <widget class="PixmapDial" name="dial_drywet"> | |||
| <property name="minimumSize"> | |||
| <size> | |||
| <width>34</width> | |||
| <height>34</height> | |||
| </size> | |||
| </property> | |||
| <property name="maximumSize"> | |||
| <size> | |||
| <width>34</width> | |||
| <height>34</height> | |||
| </size> | |||
| </property> | |||
| <property name="contextMenuPolicy"> | |||
| <enum>Qt::CustomContextMenu</enum> | |||
| </property> | |||
| <property name="statusTip"> | |||
| <string>Output dry/wet (100%)</string> | |||
| </property> | |||
| <property name="maximum"> | |||
| <number>1000</number> | |||
| </property> | |||
| <property name="value"> | |||
| <number>1000</number> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| <item> | |||
| <widget class="PixmapDial" name="dial_vol"> | |||
| <property name="minimumSize"> | |||
| <size> | |||
| <width>34</width> | |||
| <height>34</height> | |||
| </size> | |||
| </property> | |||
| <property name="maximumSize"> | |||
| <size> | |||
| <width>34</width> | |||
| <height>34</height> | |||
| </size> | |||
| </property> | |||
| <property name="contextMenuPolicy"> | |||
| <enum>Qt::CustomContextMenu</enum> | |||
| </property> | |||
| <property name="statusTip"> | |||
| <string>Output volume (100%)</string> | |||
| </property> | |||
| <property name="maximum"> | |||
| <number>1270</number> | |||
| </property> | |||
| <property name="value"> | |||
| <number>1000</number> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| <item> | |||
| <layout class="QVBoxLayout" name="verticalLayout_2"> | |||
| <property name="spacing"> | |||
| <number>1</number> | |||
| </property> | |||
| <property name="leftMargin"> | |||
| <number>0</number> | |||
| </property> | |||
| <property name="topMargin"> | |||
| <number>0</number> | |||
| </property> | |||
| <property name="rightMargin"> | |||
| <number>0</number> | |||
| </property> | |||
| <property name="bottomMargin"> | |||
| <number>4</number> | |||
| </property> | |||
| <item> | |||
| <widget class="DigitalPeakMeter" name="peak_in" native="true"> | |||
| <property name="minimumSize"> | |||
| <size> | |||
| <width>150</width> | |||
| <height>0</height> | |||
| </size> | |||
| </property> | |||
| <property name="maximumSize"> | |||
| <size> | |||
| <width>150</width> | |||
| <height>16777215</height> | |||
| </size> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| <item> | |||
| <widget class="DigitalPeakMeter" name="peak_out" native="true"> | |||
| <property name="minimumSize"> | |||
| <size> | |||
| <width>150</width> | |||
| <height>0</height> | |||
| </size> | |||
| </property> | |||
| <property name="maximumSize"> | |||
| <size> | |||
| <width>150</width> | |||
| <height>16777215</height> | |||
| </size> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| </layout> | |||
| </item> | |||
| <item> | |||
| <widget class="QWidget" name="w_screws_right" native="true"> | |||
| <property name="minimumSize"> | |||
| <size> | |||
| <width>20</width> | |||
| <height>0</height> | |||
| </size> | |||
| </property> | |||
| <property name="maximumSize"> | |||
| <size> | |||
| <width>20</width> | |||
| <height>16777215</height> | |||
| </size> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| </layout> | |||
| </item> | |||
| </layout> | |||
| </widget> | |||
| <customwidgets> | |||
| <customwidget> | |||
| <class>DigitalPeakMeter</class> | |||
| <extends>QWidget</extends> | |||
| <header>digitalpeakmeter.h</header> | |||
| <container>1</container> | |||
| </customwidget> | |||
| <customwidget> | |||
| <class>PixmapButton</class> | |||
| <extends>QPushButton</extends> | |||
| <header>pixmapbutton.h</header> | |||
| </customwidget> | |||
| <customwidget> | |||
| <class>PixmapDial</class> | |||
| <extends>QDial</extends> | |||
| <header>pixmapdial.h</header> | |||
| </customwidget> | |||
| </customwidgets> | |||
| <resources> | |||
| <include location="../resources.qrc"/> | |||
| </resources> | |||
| <connections/> | |||
| </ui> | |||
| @@ -279,14 +279,14 @@ | |||
| <container>1</container> | |||
| </customwidget> | |||
| <customwidget> | |||
| <class>PixmapButton</class> | |||
| <class>LEDButton</class> | |||
| <extends>QPushButton</extends> | |||
| <header>pixmapbutton.h</header> | |||
| <header>ledbutton.h</header> | |||
| </customwidget> | |||
| <customwidget> | |||
| <class>LEDButton</class> | |||
| <class>PixmapButton</class> | |||
| <extends>QPushButton</extends> | |||
| <header>ledbutton.h</header> | |||
| <header>pixmapbutton.h</header> | |||
| </customwidget> | |||
| </customwidgets> | |||
| <resources> | |||
| @@ -54,14 +54,14 @@ | |||
| <widget class="PixmapButton" name="b_enable"> | |||
| <property name="minimumSize"> | |||
| <size> | |||
| <width>22</width> | |||
| <height>22</height> | |||
| <width>24</width> | |||
| <height>24</height> | |||
| </size> | |||
| </property> | |||
| <property name="maximumSize"> | |||
| <size> | |||
| <width>22</width> | |||
| <height>22</height> | |||
| <width>24</width> | |||
| <height>24</height> | |||
| </size> | |||
| </property> | |||
| <property name="text"> | |||
| @@ -89,14 +89,14 @@ | |||
| <widget class="PixmapButton" name="b_gui"> | |||
| <property name="minimumSize"> | |||
| <size> | |||
| <width>22</width> | |||
| <height>22</height> | |||
| <width>24</width> | |||
| <height>24</height> | |||
| </size> | |||
| </property> | |||
| <property name="maximumSize"> | |||
| <size> | |||
| <width>22</width> | |||
| <height>22</height> | |||
| <width>24</width> | |||
| <height>24</height> | |||
| </size> | |||
| </property> | |||
| <property name="text"> | |||
| @@ -124,14 +124,14 @@ | |||
| <widget class="PixmapButton" name="b_edit"> | |||
| <property name="minimumSize"> | |||
| <size> | |||
| <width>22</width> | |||
| <height>22</height> | |||
| <width>24</width> | |||
| <height>24</height> | |||
| </size> | |||
| </property> | |||
| <property name="maximumSize"> | |||
| <size> | |||
| <width>22</width> | |||
| <height>22</height> | |||
| <width>24</width> | |||
| <height>24</height> | |||
| </size> | |||
| </property> | |||
| <property name="text"> | |||
| @@ -1511,7 +1511,9 @@ protected: | |||
| } | |||
| } | |||
| #ifndef BUILD_BRIDGE | |||
| carla_fill<jack_port_t*>(fRackPorts, kRackPortCount, nullptr); | |||
| #endif | |||
| fClient = nullptr; | |||
| callback(ENGINE_CALLBACK_QUIT, 0, 0, 0, 0.0f, nullptr); | |||
| @@ -258,15 +258,11 @@ void CarlaPluginThread::run() | |||
| CARLA_ASSERT(fProcess->state() == QProcess::NotRunning); | |||
| if (fProcess->exitCode() != 0 || fProcess->exitStatus() == QProcess::CrashExit) | |||
| { | |||
| carla_stderr("CarlaPluginThread::run() - GUI crashed while opening"); | |||
| fEngine->callback(CarlaBackend::ENGINE_CALLBACK_UI_STATE_CHANGED, fPlugin->getId(), -1, 0, 0.0f, nullptr); | |||
| } | |||
| else | |||
| { | |||
| carla_debug("CarlaPluginThread::run() - GUI timeout"); | |||
| fEngine->callback(CarlaBackend::ENGINE_CALLBACK_UI_STATE_CHANGED, fPlugin->getId(), 0, 0, 0.0f, nullptr); | |||
| } | |||
| carla_stdout("CarlaPluginThread::run() - GUI timeout"); | |||
| fEngine->callback(CarlaBackend::ENGINE_CALLBACK_UI_STATE_CHANGED, fPlugin->getId(), 0, 0, 0.0f, nullptr); | |||
| } | |||
| break; | |||
| @@ -19,7 +19,7 @@ | |||
| # ------------------------------------------------------------------------------------------------------------ | |||
| # Imports (Global) | |||
| from PyQt4.QtCore import QSize, QTimer | |||
| from PyQt4.QtCore import Qt, QSize, QTimer | |||
| from PyQt4.QtGui import QApplication, QListWidget, QListWidgetItem | |||
| # ------------------------------------------------------------------------------------------------------------ | |||
| @@ -39,6 +39,7 @@ class CarlaRackItem(QListWidgetItem): | |||
| self.widget = createPluginSlot(parent, pluginId) | |||
| self.widget.setFixedHeight(self.widget.getFixedHeight()) | |||
| self.setFlags(Qt.ItemIsSelectable|Qt.ItemIsEnabled) # Qt.ItemIsDragEnabled|Qt.ItemIsDropEnabled | |||
| self.setSizeHint(QSize(300, self.widget.getFixedHeight())) | |||
| parent.setItemWidget(self, self.widget) | |||
| @@ -55,6 +56,20 @@ class CarlaRackItem(QListWidgetItem): | |||
| #self.widget.ui.label_name.setText(newName) | |||
| #self.widget.ui.edit_dialog.setName(newName) | |||
| # ----------------------------------------------------------------- | |||
| #def paintEvent(self, event): | |||
| #painter = QPainter(self) | |||
| #painter.save() | |||
| #painter.setPen(QPen(Qt.black, 3)) | |||
| #painter.setBrush(Qt.black) | |||
| #painter.drawRect(0, 0, self.width(), self.height()) | |||
| #painter.drawLine(0, self.height()-4, self.width(), self.height()-4) | |||
| #painter.restore() | |||
| #QListWidgetItem.paintEvent(self, event) | |||
| # ------------------------------------------------------------------------------------------------------------ | |||
| # Rack widget | |||
| @@ -69,28 +84,33 @@ class CarlaRackW(QListWidget): | |||
| self.fPluginCount = 0 | |||
| self.fPluginList = [] | |||
| self.fCurrentRow = -1 | |||
| self.fLastSelectedItem = None | |||
| # ------------------------------------------------------------- | |||
| # Set-up GUI stuff | |||
| self.setMinimumWidth(640) # required by zita, 591 was old value | |||
| self.setMinimumWidth(644) # required by zita, 591 was old value | |||
| self.setSortingEnabled(False) | |||
| app = QApplication.instance() | |||
| pal1 = app.palette().base().color() | |||
| pal2 = app.palette().button().color() | |||
| col1 = "stop:0 rgb(%i, %i, %i)" % (pal1.red(), pal1.green(), pal1.blue()) | |||
| col2 = "stop:1 rgb(%i, %i, %i)" % (pal2.red(), pal2.green(), pal2.blue()) | |||
| self.setStyleSheet(""" | |||
| QListWidget { | |||
| background-color: qlineargradient(spread:pad, | |||
| x1:0.0, y1:0.0, | |||
| x2:0.2, y2:1.0, | |||
| %s, | |||
| %s | |||
| ); | |||
| } | |||
| """ % (col1, col2)) | |||
| self.currentRowChanged.connect(self.slot_currentRowChanged) | |||
| #app = QApplication.instance() | |||
| #pal1 = app.palette().base().color() | |||
| #pal2 = app.palette().button().color() | |||
| #col1 = "stop:0 rgb(%i, %i, %i)" % (pal1.red(), pal1.green(), pal1.blue()) | |||
| #col2 = "stop:1 rgb(%i, %i, %i)" % (pal2.red(), pal2.green(), pal2.blue()) | |||
| #self.setStyleSheet(""" | |||
| #QListWidget { | |||
| #background-color: qlineargradient(spread:pad, | |||
| #x1:0.0, y1:0.0, | |||
| #x2:0.2, y2:1.0, | |||
| #%s, | |||
| #%s | |||
| #); | |||
| #} | |||
| #""" % (col1, col2)) | |||
| # ------------------------------------------------------------- | |||
| # Connect actions to functions | |||
| @@ -507,3 +527,19 @@ class CarlaRackW(QListWidget): | |||
| pitem.widget.fEditDialog.reloadAll() | |||
| # ----------------------------------------------------------------- | |||
| def slot_currentRowChanged(self, row): | |||
| self.fCurrentRow = row | |||
| if self.fLastSelectedItem is not None: | |||
| self.fLastSelectedItem.setSelected(False) | |||
| if row < 0 or row >= self.fPluginCount or self.fPluginList[row] is None: | |||
| self.fLastSelectedItem = None | |||
| return | |||
| pitem = self.fPluginList[row] | |||
| pitem.widget.setSelected(True) | |||
| self.fLastSelectedItem = pitem.widget | |||
| # ----------------------------------------------------------------- | |||
| @@ -621,6 +621,38 @@ def getAndSetPath(self_, currentPath, lineEdit): | |||
| lineEdit.setText(newPath) | |||
| return newPath | |||
| # ------------------------------------------------------------------------------------------------------------ | |||
| # Get plugin type as string | |||
| def getPluginTypeAsString(ptype): | |||
| if ptype == PLUGIN_INTERNAL: | |||
| return "Internal" | |||
| if ptype == PLUGIN_LADSPA: | |||
| return "LADSPA" | |||
| if ptype == PLUGIN_DSSI: | |||
| return "DSSI" | |||
| if ptype == PLUGIN_LV2: | |||
| return "LV2" | |||
| if ptype == PLUGIN_VST: | |||
| return "VST" | |||
| if ptype == PLUGIN_VST3: | |||
| return "VST3" | |||
| if ptype == PLUGIN_AU: | |||
| return "AU" | |||
| if ptype == PLUGIN_JACK: | |||
| return "JACK" | |||
| if ptype == PLUGIN_REWIRE: | |||
| return "ReWire" | |||
| if ptype == PLUGIN_FILE_CSD: | |||
| return "CSD" | |||
| if ptype == PLUGIN_FILE_GIG: | |||
| return "GIG" | |||
| if ptype == PLUGIN_FILE_SF2: | |||
| return "SF2" | |||
| if ptype == PLUGIN_FILE_SFZ: | |||
| return "SFZ" | |||
| return "Unknown" | |||
| # ------------------------------------------------------------------------------------------------------------ | |||
| # Custom MessageBox | |||
| @@ -19,12 +19,14 @@ | |||
| # ------------------------------------------------------------------------------------------------------------ | |||
| # Imports (Global) | |||
| from PyQt4.QtGui import QFont, QFrame, QPushButton | |||
| from PyQt4.QtCore import Qt | |||
| from PyQt4.QtGui import QFont, QFrame, QPen, QPushButton | |||
| # ------------------------------------------------------------------------------------------------------------ | |||
| # Imports (Custom) | |||
| import ui_carla_plugin_default | |||
| import ui_carla_plugin_basic_fx | |||
| import ui_carla_plugin_calf | |||
| import ui_carla_plugin_zita | |||
| import ui_carla_plugin_zynfx | |||
| @@ -59,6 +61,7 @@ class AbstractPluginSlot(QFrame): | |||
| # Internal stuff | |||
| self.fIsActive = False | |||
| self.fIsSelected = False | |||
| self.fLastGreenLedState = False | |||
| self.fLastBlueLedState = False | |||
| @@ -97,7 +100,9 @@ class AbstractPluginSlot(QFrame): | |||
| self.cb_presets = None | |||
| self.label_name = None | |||
| self.label_name = None | |||
| self.label_type = None | |||
| self.led_control = None | |||
| self.led_midi = None | |||
| self.led_audio_in = None | |||
| @@ -130,6 +135,9 @@ class AbstractPluginSlot(QFrame): | |||
| if self.label_name is not None: | |||
| self.label_name.setText(self.fPluginInfo['name']) | |||
| if self.label_type is not None: | |||
| self.label_type.setText(getPluginTypeAsString(self.fPluginInfo['type'])) | |||
| if self.led_control is not None: | |||
| self.led_control.setColor(self.led_control.YELLOW) | |||
| self.led_control.setEnabled(False) | |||
| @@ -158,7 +166,9 @@ class AbstractPluginSlot(QFrame): | |||
| for paramIndex, paramWidget in self.fParameterList: | |||
| paramWidget.valueChanged.connect(self.slot_parameterValueChanged) | |||
| paramWidget.setValue(Carla.host.get_current_parameter_value(self.fPluginId, paramIndex) * 1000) | |||
| if paramIndex >= 0 and Carla.host is not None: | |||
| paramWidget.setValue(Carla.host.get_current_parameter_value(self.fPluginId, paramIndex) * 1000) | |||
| #------------------------------------------------------------------ | |||
| @@ -186,6 +196,13 @@ class AbstractPluginSlot(QFrame): | |||
| if self.label_name is not None: | |||
| self.label_name.setText(name) | |||
| def setSelected(self, yesNo): | |||
| if self.fIsSelected == yesNo: | |||
| return | |||
| self.fIsSelected = yesNo | |||
| self.update() | |||
| #------------------------------------------------------------------ | |||
| def setActive(self, active, sendGui=False, sendCallback=True): | |||
| @@ -420,6 +437,18 @@ class AbstractPluginSlot(QFrame): | |||
| #------------------------------------------------------------------ | |||
| def drawOutline(self): | |||
| painter = QPainter(self) | |||
| if self.fIsSelected: | |||
| painter.setPen(QPen(Qt.cyan, 4)) | |||
| painter.setBrush(Qt.transparent) | |||
| painter.drawRect(0, 0, self.width(), self.height()) | |||
| else: | |||
| painter.setPen(QPen(Qt.black, 1)) | |||
| painter.setBrush(Qt.black) | |||
| painter.drawLine(0, self.height()-1, self.width(), self.height()-1) | |||
| def showDefaultCustomMenu(self, isEnabled, bEdit = None, bGui = None): | |||
| menu = QMenu(self) | |||
| @@ -513,8 +542,11 @@ class AbstractPluginSlot(QFrame): | |||
| index = self.sender().getIndex() | |||
| value = float(value)/1000.0 | |||
| Carla.host.set_parameter_value(self.fPluginId, index, value) | |||
| self.setParameterValue(index, value, False) | |||
| if index < 0: | |||
| self.setInternalParameter(index, value) | |||
| else: | |||
| Carla.host.set_parameter_value(self.fPluginId, index, value) | |||
| self.setParameterValue(index, value, False) | |||
| @pyqtSlot(int) | |||
| def slot_programChanged(self, index): | |||
| @@ -526,6 +558,12 @@ class AbstractPluginSlot(QFrame): | |||
| Carla.host.set_midi_program(self.fPluginId, index) | |||
| self.setMidiProgram(index, False) | |||
| #------------------------------------------------------------------ | |||
| def paintEvent(self, event): | |||
| self.drawOutline() | |||
| QFrame.paintEvent(self, event) | |||
| # ------------------------------------------------------------------------------------------------------------ | |||
| class PluginSlot_Default(AbstractPluginSlot): | |||
| @@ -606,7 +644,7 @@ class PluginSlot_Default(AbstractPluginSlot): | |||
| #------------------------------------------------------------------ | |||
| def getFixedHeight(self): | |||
| return 48 | |||
| return 36 | |||
| #------------------------------------------------------------------ | |||
| @@ -657,6 +695,166 @@ class PluginSlot_Default(AbstractPluginSlot): | |||
| # ------------------------------------------------------------------------------------------------------------ | |||
| class PluginSlot_BasicFX(AbstractPluginSlot): | |||
| def __init__(self, parent, pluginId): | |||
| AbstractPluginSlot.__init__(self, parent, pluginId) | |||
| self.ui = ui_carla_plugin_basic_fx.Ui_PluginWidget() | |||
| self.ui.setupUi(self) | |||
| # ------------------------------------------------------------- | |||
| # Set-up GUI | |||
| labelFont = QFont() | |||
| labelFont.setBold(True) | |||
| labelFont.setPointSize(9) | |||
| self.ui.label_name.setFont(labelFont) | |||
| self.ui.label_type.setFont(labelFont) | |||
| r = 40 | |||
| g = 40 | |||
| b = 40 | |||
| if self.fPluginInfo['category'] == PLUGIN_CATEGORY_MODULATOR: | |||
| r += 10 | |||
| elif self.fPluginInfo['category'] == PLUGIN_CATEGORY_EQ: | |||
| g += 10 | |||
| elif self.fPluginInfo['category'] == PLUGIN_CATEGORY_FILTER: | |||
| b += 10 | |||
| elif self.fPluginInfo['category'] == PLUGIN_CATEGORY_DELAY: | |||
| r += 15 | |||
| b -= 15 | |||
| elif self.fPluginInfo['category'] == PLUGIN_CATEGORY_DISTORTION: | |||
| g += 10 | |||
| b += 10 | |||
| elif self.fPluginInfo['category'] == PLUGIN_CATEGORY_DYNAMICS: | |||
| r += 10 | |||
| b += 10 | |||
| elif self.fPluginInfo['category'] == PLUGIN_CATEGORY_UTILITY: | |||
| r += 10 | |||
| g += 10 | |||
| self.setStyleSheet(""" | |||
| QFrame#PluginWidget { | |||
| background-color: rgb(%i, %i, %i); | |||
| background-image: url(:/bitmaps/background_noise1.png); | |||
| background-repeat: repeat-xy; | |||
| }""" % (r, g, b)) | |||
| self.ui.b_enable.setPixmaps(":/bitmaps/button_off.png", ":/bitmaps/button_on.png", ":/bitmaps/button_off.png") | |||
| self.ui.b_edit.setPixmaps(":/bitmaps/button_edit.png", ":/bitmaps/button_edit_down.png", ":/bitmaps/button_edit_hover.png") | |||
| if self.fPluginInfo['iconName'] == "distrho": | |||
| self.ui.b_gui.setPixmaps(":/bitmaps/button_distrho.png", ":/bitmaps/button_distrho_down.png", ":/bitmaps/button_distrho_hover.png") | |||
| elif self.fPluginInfo['iconName'] == "file": | |||
| self.ui.b_gui.setPixmaps(":/bitmaps/button_file.png", ":/bitmaps/button_file_down.png", ":/bitmaps/button_file_hover.png") | |||
| else: | |||
| self.ui.b_gui.setPixmaps(":/bitmaps/button_gui.png", ":/bitmaps/button_gui_down.png", ":/bitmaps/button_gui_hover.png") | |||
| # ------------------------------------------------------------- | |||
| # Set-up parameters | |||
| parameterCount = Carla.host.get_parameter_count(self.fPluginId) if Carla.host is not None else 0 | |||
| index = 0 | |||
| for i in range(min(parameterCount, 8)): | |||
| paramInfo = Carla.host.get_parameter_info(self.fPluginId, i) | |||
| paramData = Carla.host.get_parameter_data(self.fPluginId, i) | |||
| paramRanges = Carla.host.get_parameter_ranges(self.fPluginId, i) | |||
| if paramData['type'] != PARAMETER_INPUT: | |||
| continue | |||
| paramName = charPtrToString(paramInfo['name']).split("/", 1)[0].split(" (", 1)[0].strip() | |||
| paramLow = paramName.lower() | |||
| if "Bandwidth" in paramName: | |||
| paramName = paramName.replace("Bandwidth", "Bw") | |||
| elif "Frequency" in paramName: | |||
| paramName = paramName.replace("Frequency", "Freq") | |||
| elif "Output" in paramName: | |||
| paramName = paramName.replace("Output", "Out") | |||
| elif paramLow == "threshold": | |||
| paramName = "Thres" | |||
| if len(paramName) > 9: | |||
| paramName = paramName[:9] | |||
| #if self.fPluginInfo['category'] == PLUGIN_CATEGORY_FILTER: | |||
| #_r = 55 + float(i)/8*200 | |||
| #_g = 255 - float(i)/8*200 | |||
| #_b = 127 - r*2 | |||
| #elif self.fPluginInfo['category'] == PLUGIN_CATEGORY_DELAY: | |||
| #_r = 127 | |||
| #_g = 55 + float(i)/8*200 | |||
| #_b = 255 - float(i)/8*200 | |||
| #elif r < b < g: | |||
| #_r = 55 + float(i)/8*200 | |||
| #_g = 127 | |||
| #_b = 255 - float(i)/8*200 | |||
| #else: | |||
| _r = 255 - float(i)/8*200 | |||
| _g = 55 + float(i)/8*200 | |||
| _b = (r-40)*4 | |||
| #if _r < 140: _r = 140 | |||
| #if _g < 140: _g = 140 | |||
| #if _b < 140: _b = 140 | |||
| widget = PixmapDial(self, i) | |||
| widget.setPixmap(3) | |||
| widget.setLabel(paramName) | |||
| widget.setCustomColor(QColor(_r, _g, _b)) | |||
| widget.setCustomPaint(PixmapDial.CUSTOM_PAINT_COLOR) | |||
| widget.setSingleStep(paramRanges['step']*1000) | |||
| widget.setMinimum(paramRanges['min']*1000) | |||
| widget.setMaximum(paramRanges['max']*1000) | |||
| if (paramData['hints'] & PARAMETER_IS_ENABLED) == 0: | |||
| widget.setEnabled(False) | |||
| self.ui.w_knobs.layout().insertWidget(index, widget) | |||
| index += 1 | |||
| self.fParameterList.append([i, widget]) | |||
| self.ui.dial_drywet.setIndex(PARAMETER_DRYWET) | |||
| self.ui.dial_drywet.setPixmap(3) | |||
| self.ui.dial_drywet.setLabel("Dry/Wet") | |||
| self.ui.dial_drywet.setCustomPaint(PixmapDial.CUSTOM_PAINT_CARLA_WET) | |||
| self.ui.dial_vol.setIndex(PARAMETER_VOLUME) | |||
| self.ui.dial_vol.setPixmap(3) | |||
| self.ui.dial_vol.setLabel("Volume") | |||
| self.ui.dial_vol.setCustomPaint(PixmapDial.CUSTOM_PAINT_CARLA_VOL) | |||
| self.fParameterList.append([PARAMETER_DRYWET, self.ui.dial_drywet]) | |||
| self.fParameterList.append([PARAMETER_VOLUME, self.ui.dial_vol]) | |||
| # ------------------------------------------------------------- | |||
| self.b_enable = self.ui.b_enable | |||
| self.b_gui = self.ui.b_gui | |||
| self.b_edit = self.ui.b_edit | |||
| self.label_name = self.ui.label_name | |||
| self.label_type = self.ui.label_type | |||
| self.peak_in = self.ui.peak_in | |||
| self.peak_out = self.ui.peak_out | |||
| self.ready() | |||
| self.customContextMenuRequested.connect(self.slot_showDefaultCustomMenu) | |||
| #------------------------------------------------------------------ | |||
| def getFixedHeight(self): | |||
| return 79 | |||
| # ------------------------------------------------------------------------------------------------------------ | |||
| class PluginSlot_Calf(AbstractPluginSlot): | |||
| def __init__(self, parent, pluginId): | |||
| AbstractPluginSlot.__init__(self, parent, pluginId) | |||
| @@ -677,13 +875,15 @@ class PluginSlot_Calf(AbstractPluginSlot): | |||
| # Set-up GUI | |||
| self.setStyleSheet(""" | |||
| QLabel#label_name, QLabel#label_audio_in, QLabel#label_audio_out, QLabel#label_midi { | |||
| color: black; | |||
| } | |||
| QFrame#PluginWidget { | |||
| background-image: url(:/bitmaps/background_calf.png); | |||
| background-repeat: repeat-xy; | |||
| }""") | |||
| QLabel#label_name, QLabel#label_audio_in, QLabel#label_audio_out, QLabel#label_midi { | |||
| color: black; | |||
| } | |||
| QFrame#PluginWidget { | |||
| background-image: url(:/bitmaps/background_calf.png); | |||
| background-repeat: repeat-xy; | |||
| border: 2px; | |||
| } | |||
| """) | |||
| 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") | |||
| @@ -741,7 +941,7 @@ class PluginSlot_Calf(AbstractPluginSlot): | |||
| #------------------------------------------------------------------ | |||
| def getFixedHeight(self): | |||
| return 75 | |||
| return 70 | |||
| #------------------------------------------------------------------ | |||
| @@ -772,24 +972,25 @@ class PluginSlot_ZitaRev(AbstractPluginSlot): | |||
| self.setMinimumWidth(640) | |||
| self.setStyleSheet(""" | |||
| QFrame#PluginWidget { | |||
| background-color: #404040; | |||
| } | |||
| QWidget#w_revsect { | |||
| background-image: url(:/bitmaps/zita-rev/revsect.png); | |||
| } | |||
| QWidget#w_eq1sect { | |||
| background-image: url(:/bitmaps/zita-rev/eq1sect.png); | |||
| } | |||
| QWidget#w_eq2sect { | |||
| background-image: url(:/bitmaps/zita-rev/eq2sect.png); | |||
| } | |||
| QWidget#w_ambmixsect { | |||
| background-image: url(:/bitmaps/zita-rev/%s.png); | |||
| } | |||
| QWidget#w_redzita { | |||
| background-image: url(:/bitmaps/zita-rev/redzita.png); | |||
| } | |||
| QFrame#PluginWidget { | |||
| background-color: #404040; | |||
| border: 2px solid transparent; | |||
| } | |||
| QWidget#w_revsect { | |||
| background-image: url(:/bitmaps/zita-rev/revsect.png); | |||
| } | |||
| QWidget#w_eq1sect { | |||
| background-image: url(:/bitmaps/zita-rev/eq1sect.png); | |||
| } | |||
| QWidget#w_eq2sect { | |||
| background-image: url(:/bitmaps/zita-rev/eq2sect.png); | |||
| } | |||
| QWidget#w_ambmixsect { | |||
| background-image: url(:/bitmaps/zita-rev/%s.png); | |||
| } | |||
| QWidget#w_redzita { | |||
| background-image: url(:/bitmaps/zita-rev/redzita.png); | |||
| } | |||
| """ % ("mixsect" if audioCount['outs'] == 2 else "ambsect")) | |||
| # ------------------------------------------------------------- | |||
| @@ -875,19 +1076,25 @@ class PluginSlot_ZitaRev(AbstractPluginSlot): | |||
| #------------------------------------------------------------------ | |||
| def getFixedHeight(self): | |||
| return 75 | |||
| return 79 | |||
| #------------------------------------------------------------------ | |||
| def paintEvent(self, event): | |||
| AbstractPluginSlot.paintEvent(self, event) | |||
| self.drawOutline() | |||
| def resizeEvent(self, event): | |||
| self.fKnobDelay.move(self.ui.w_revsect.x()+31, 33) | |||
| self.fKnobXover.move(self.ui.w_revsect.x()+93, 18) | |||
| self.fKnobRtLow.move(self.ui.w_revsect.x()+148, 18) | |||
| self.fKnobRtMid.move(self.ui.w_revsect.x()+208, 18) | |||
| self.fKnobDamping.move(self.ui.w_revsect.x()+268, 18) | |||
| self.fKnobEq1Freq.move(self.ui.w_eq1sect.x()+20, 33) | |||
| self.fKnobEq1Gain.move(self.ui.w_eq1sect.x()+69, 18) | |||
| self.fKnobEq2Freq.move(self.ui.w_eq2sect.x()+20, 33) | |||
| self.fKnobEq2Gain.move(self.ui.w_eq2sect.x()+69, 18) | |||
| self.fKnobMix.move(self.ui.w_ambmixsect.x()+24, 33) | |||
| self.fKnobDelay.move(self.ui.w_revsect.x()+31, self.ui.w_revsect.y()+33) | |||
| self.fKnobXover.move(self.ui.w_revsect.x()+93, self.ui.w_revsect.y()+18) | |||
| self.fKnobRtLow.move(self.ui.w_revsect.x()+148, self.ui.w_revsect.y()+18) | |||
| self.fKnobRtMid.move(self.ui.w_revsect.x()+208, self.ui.w_revsect.y()+18) | |||
| self.fKnobDamping.move(self.ui.w_revsect.x()+268, self.ui.w_revsect.y()+18) | |||
| self.fKnobEq1Freq.move(self.ui.w_eq1sect.x()+20, self.ui.w_eq1sect.y()+33) | |||
| self.fKnobEq1Gain.move(self.ui.w_eq1sect.x()+69, self.ui.w_eq1sect.y()+18) | |||
| self.fKnobEq2Freq.move(self.ui.w_eq2sect.x()+20, self.ui.w_eq2sect.y()+33) | |||
| self.fKnobEq2Gain.move(self.ui.w_eq2sect.x()+69, self.ui.w_eq2sect.y()+18) | |||
| self.fKnobMix.move(self.ui.w_ambmixsect.x()+24, self.ui.w_ambmixsect.y()+33) | |||
| AbstractPluginSlot.resizeEvent(self, event) | |||
| # ------------------------------------------------------------------------------------------------------------ | |||
| @@ -902,10 +1109,12 @@ class PluginSlot_ZynFX(AbstractPluginSlot): | |||
| # Set-up GUI | |||
| self.setStyleSheet(""" | |||
| QFrame#PluginWidget { | |||
| background-image: url(:/bitmaps/background_zynfx.png); | |||
| background-repeat: repeat-xy; | |||
| }""") | |||
| QFrame#PluginWidget { | |||
| background-image: url(:/bitmaps/background_zynfx.png); | |||
| background-repeat: repeat-xy; | |||
| border: 2px; | |||
| } | |||
| """) | |||
| self.ui.b_enable.setPixmaps(":/bitmaps/button_off.png", ":/bitmaps/button_on.png", ":/bitmaps/button_off.png") | |||
| self.ui.b_edit.setPixmaps(":/bitmaps/button_edit.png", ":/bitmaps/button_edit_down.png", ":/bitmaps/button_edit_hover.png") | |||
| @@ -1088,7 +1297,7 @@ def createPluginSlot(parent, pluginId): | |||
| if pluginName.split(" ", 1)[0].lower() == "calf": | |||
| return PluginSlot_Calf(parent, pluginId) | |||
| #return PluginSlot_Pixmap(parent, pluginId) | |||
| return PluginSlot_BasicFX(parent, pluginId) | |||
| return PluginSlot_Default(parent, pluginId) | |||
| # ------------------------------------------------------------------------------------------------------------ | |||
| @@ -1099,27 +1308,12 @@ if __name__ == '__main__': | |||
| import resources_rc | |||
| app = CarlaApplication("Carla-Skins") | |||
| #gui = PluginSlot_BasicFX(None, 0) | |||
| #gui = PluginSlot_Calf(None, 0) | |||
| #gui = PluginSlot_Default(None, 0) | |||
| #gui = PluginSlot_ZitaRev(None, 0) | |||
| gui = PluginSlot_ZynFX(None, 0) | |||
| gui.setSelected(True) | |||
| gui.show() | |||
| app.exec_() | |||
| #if (self.pinfo['category'] == PLUGIN_CATEGORY_SYNTH): | |||
| #self.set_plugin_widget_color(PALETTE_COLOR_WHITE) | |||
| #elif (self.pinfo['category'] == PLUGIN_CATEGORY_DELAY): | |||
| #self.set_plugin_widget_color(PALETTE_COLOR_ORANGE) | |||
| #elif (self.pinfo['category'] == PLUGIN_CATEGORY_EQ): | |||
| #self.set_plugin_widget_color(PALETTE_COLOR_GREEN) | |||
| #elif (self.pinfo['category'] == PLUGIN_CATEGORY_FILTER): | |||
| #self.set_plugin_widget_color(PALETTE_COLOR_BLUE) | |||
| #elif (self.pinfo['category'] == PLUGIN_CATEGORY_DYNAMICS): | |||
| #self.set_plugin_widget_color(PALETTE_COLOR_PINK) | |||
| #elif (self.pinfo['category'] == PLUGIN_CATEGORY_MODULATOR): | |||
| #self.set_plugin_widget_color(PALETTE_COLOR_RED) | |||
| #elif (self.pinfo['category'] == PLUGIN_CATEGORY_UTILITY): | |||
| #self.set_plugin_widget_color(PALETTE_COLOR_YELLOW) | |||
| #elif (self.pinfo['category'] == PLUGIN_CATEGORY_OUTRO): | |||
| #self.set_plugin_widget_color(PALETTE_COLOR_BROWN) | |||
| #else: | |||
| #self.set_plugin_widget_color(PALETTE_COLOR_NONE) | |||
| @@ -549,33 +549,9 @@ class PluginEdit(QDialog): | |||
| midiCountInfo = gFakePortCountInfo | |||
| paramCountInfo = gFakePortCountInfo | |||
| pluginType = self.fPluginInfo['type'] | |||
| pluginHints = self.fPluginInfo['hints'] | |||
| if pluginType == PLUGIN_INTERNAL: | |||
| self.ui.le_type.setText(self.tr("Internal")) | |||
| elif pluginType == PLUGIN_LADSPA: | |||
| self.ui.le_type.setText("LADSPA") | |||
| elif pluginType == PLUGIN_DSSI: | |||
| self.ui.le_type.setText("DSSI") | |||
| elif pluginType == PLUGIN_LV2: | |||
| self.ui.le_type.setText("LV2") | |||
| elif pluginType == PLUGIN_VST: | |||
| self.ui.le_type.setText("VST") | |||
| elif pluginType == PLUGIN_AU: | |||
| self.ui.le_type.setText("AU") | |||
| elif pluginType == PLUGIN_REWIRE: | |||
| self.ui.le_type.setText("ReWire") | |||
| elif pluginType == PLUGIN_FILE_CSD: | |||
| self.ui.le_type.setText("CSD") | |||
| elif pluginType == PLUGIN_FILE_GIG: | |||
| self.ui.le_type.setText("GIG") | |||
| elif pluginType == PLUGIN_FILE_SF2: | |||
| self.ui.le_type.setText("SF2") | |||
| elif pluginType == PLUGIN_FILE_SFZ: | |||
| self.ui.le_type.setText("SFZ") | |||
| else: | |||
| self.ui.le_type.setText(self.tr("Unknown")) | |||
| self.ui.le_type.setText(getPluginTypeAsString(self.fPluginInfo['type'])) | |||
| if pluginName: | |||
| self.ui.label_name.setEnabled(True) | |||
| @@ -35,8 +35,9 @@ class PixmapDial(QDial): | |||
| CUSTOM_PAINT_CARLA_VOL = 2 | |||
| CUSTOM_PAINT_CARLA_L = 3 | |||
| CUSTOM_PAINT_CARLA_R = 4 | |||
| CUSTOM_PAINT_ZITA = 5 | |||
| CUSTOM_PAINT_NO_GRADIENT = 6 | |||
| CUSTOM_PAINT_COLOR = 5 | |||
| CUSTOM_PAINT_ZITA = 6 | |||
| CUSTOM_PAINT_NO_GRADIENT = 7 | |||
| # enum Orientation | |||
| HORIZONTAL = 0 | |||
| @@ -51,6 +52,8 @@ class PixmapDial(QDial): | |||
| self.fIndex = index | |||
| self.fPixmap = QPixmap(":/bitmaps/dial_01d.png") | |||
| self.fPixmapNum = "01" | |||
| self.fCustomColor = QColor(0, 0, 0) | |||
| self.fCustomPaint = self.CUSTOM_PAINT_NULL | |||
| self.fIsHovered = False | |||
| @@ -89,10 +92,14 @@ class PixmapDial(QDial): | |||
| def getSize(self): | |||
| return self.fSize | |||
| def setCustomColor(self, color): | |||
| self.fCustomColor = color | |||
| #self.update() | |||
| def setCustomPaint(self, paint): | |||
| self.fCustomPaint = paint | |||
| self.fLabelPos.setY(self.fSize + self.fLabelHeight/2) | |||
| self.update() | |||
| #self.update() | |||
| def setEnabled(self, enabled): | |||
| if self.isEnabled() != enabled: | |||
| @@ -121,7 +128,7 @@ class PixmapDial(QDial): | |||
| self.fLabelGradient.setFinalStop(0, self.fSize + self.fLabelHeight + 5) | |||
| self.fLabelGradientRect = QRectF(float(self.fSize)/8.0, float(self.fSize)/2.0, float(self.fSize*6)/8.0, self.fSize+self.fLabelHeight+5) | |||
| self.update() | |||
| #self.update() | |||
| def setPixmap(self, pixmapId): | |||
| self.fPixmapNum = "%02i" % pixmapId | |||
| @@ -133,7 +140,7 @@ class PixmapDial(QDial): | |||
| self.fOrientation = self.VERTICAL | |||
| self.updateSizes() | |||
| self.update() | |||
| #self.update() | |||
| def minimumSizeHint(self): | |||
| return QSize(self.fSize, self.fSize) | |||
| @@ -215,8 +222,8 @@ class PixmapDial(QDial): | |||
| # Custom knobs (Dry/Wet and Volume) | |||
| if self.fCustomPaint in (self.CUSTOM_PAINT_CARLA_WET, self.CUSTOM_PAINT_CARLA_VOL): | |||
| # knob color | |||
| colorGreen = QColor(0x5D, 0xE7, 0x3D, 191 + self.fHoverStep*7) | |||
| colorBlue = QColor(0x3E, 0xB8, 0xBE, 191 + self.fHoverStep*7) | |||
| colorGreen = QColor(0x5D, 0xE7, 0x3D).lighter(100 + self.fHoverStep*6) | |||
| colorBlue = QColor(0x3E, 0xB8, 0xBE).lighter(100 + self.fHoverStep*6) | |||
| # draw small circle | |||
| ballRect = QRectF(8.0, 8.0, 15.0, 15.0) | |||
| @@ -259,7 +266,7 @@ class PixmapDial(QDial): | |||
| # Custom knobs (L and R) | |||
| elif self.fCustomPaint in (self.CUSTOM_PAINT_CARLA_L, self.CUSTOM_PAINT_CARLA_R): | |||
| # knob color | |||
| color = QColor(0xAD + self.fHoverStep*5, 0xD5 + self.fHoverStep*4, 0x4B + self.fHoverStep*5) | |||
| color = QColor(0xAD, 0xD5, 0x48).lighter(100 + self.fHoverStep*6) | |||
| # draw small circle | |||
| ballRect = QRectF(7.0, 8.0, 11.0, 12.0) | |||
| @@ -287,6 +294,31 @@ class PixmapDial(QDial): | |||
| painter.setPen(QPen(color, 2)) | |||
| painter.drawArc(3.5, 4.5, 22.0, 22.0, startAngle, spanAngle) | |||
| # Custom knobs (Color) | |||
| elif self.fCustomPaint == self.CUSTOM_PAINT_COLOR: | |||
| # knob color | |||
| color = self.fCustomColor.lighter(100 + self.fHoverStep*6) | |||
| # draw small circle | |||
| ballRect = QRectF(8.0, 8.0, 15.0, 15.0) | |||
| ballPath = QPainterPath() | |||
| ballPath.addEllipse(ballRect) | |||
| tmpValue = (0.375 + 0.75*value) | |||
| ballValue = tmpValue - floor(tmpValue) | |||
| ballPoint = ballPath.pointAtPercent(ballValue) | |||
| # draw arc | |||
| startAngle = 216*16 | |||
| spanAngle = -252*16*value | |||
| painter.setBrush(color) | |||
| painter.setPen(QPen(color, 0)) | |||
| painter.drawEllipse(QRectF(ballPoint.x(), ballPoint.y(), 2.2, 2.2)) | |||
| painter.setBrush(color) | |||
| painter.setPen(QPen(color, 3)) | |||
| painter.drawArc(4.0, 4.0, 26.0, 26.0, startAngle, spanAngle) | |||
| # Custom knobs (Zita) | |||
| elif self.fCustomPaint == self.CUSTOM_PAINT_ZITA: | |||
| a = value * pi * 1.5 - 2.35 | |||