| @@ -1049,14 +1049,17 @@ class CarlaMainW(QMainWindow): | |||||
| self.removeAllPlugins() | self.removeAllPlugins() | ||||
| self.fEngineStarted = False | |||||
| if Carla.host.is_engine_running() and not Carla.host.engine_close(): | if Carla.host.is_engine_running() and not Carla.host.engine_close(): | ||||
| print(cString(Carla.host.get_last_error())) | print(cString(Carla.host.get_last_error())) | ||||
| # failed | |||||
| self.fEngineStarted = True | |||||
| return | return | ||||
| self.fBufferSize = 0 | self.fBufferSize = 0 | ||||
| self.fSampleRate = 0.0 | self.fSampleRate = 0.0 | ||||
| self.fEngineStarted = False | |||||
| self.fPluginCount = 0 | self.fPluginCount = 0 | ||||
| self.fPluginList = [] | self.fPluginList = [] | ||||
| @@ -1764,6 +1767,9 @@ class CarlaMainW(QMainWindow): | |||||
| def timerEvent(self, event): | def timerEvent(self, event): | ||||
| if event.timerId() == self.fIdleTimerFast: | if event.timerId() == self.fIdleTimerFast: | ||||
| if not self.fEngineStarted: | |||||
| return | |||||
| Carla.host.engine_idle() | Carla.host.engine_idle() | ||||
| for pwidget in self.fPluginList: | for pwidget in self.fPluginList: | ||||
| @@ -1774,6 +1780,9 @@ class CarlaMainW(QMainWindow): | |||||
| self.refreshTransport() | self.refreshTransport() | ||||
| elif event.timerId() == self.fIdleTimerSlow: | elif event.timerId() == self.fIdleTimerSlow: | ||||
| if not self.fEngineStarted: | |||||
| return | |||||
| for pwidget in self.fPluginList: | for pwidget in self.fPluginList: | ||||
| if pwidget is None: | if pwidget is None: | ||||
| break | break | ||||
| @@ -8,11 +8,11 @@ include ../Makefile.mk | |||||
| # -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
| BUILD_CXX_FLAGS += -fvisibility=hidden -fPIC -I. | |||||
| BUILD_CXX_FLAGS += -fvisibility=hidden -I. | |||||
| ifeq ($(HAVE_QT5),true) | ifeq ($(HAVE_QT5),true) | ||||
| BUILD_CXX_FLAGS += $(shell pkg-config --cflags Qt5Core Qt5Widgets) | |||||
| LINK_FLAGS += $(shell pkg-config --libs Qt5Core Qt5Widgets) | |||||
| BUILD_CXX_FLAGS += $(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets) | |||||
| LINK_FLAGS += $(shell pkg-config --libs Qt5Core Qt5Gui Qt5Widgets) | |||||
| else | else | ||||
| BUILD_CXX_FLAGS += $(shell pkg-config --cflags QtCore QtGui) | BUILD_CXX_FLAGS += $(shell pkg-config --cflags QtCore QtGui) | ||||
| LINK_FLAGS += $(shell pkg-config --libs QtCore QtGui) | LINK_FLAGS += $(shell pkg-config --libs QtCore QtGui) | ||||
| @@ -18,11 +18,12 @@ | |||||
| #include "ledbutton.hpp" | #include "ledbutton.hpp" | ||||
| #include <QtGui/QPainter> | #include <QtGui/QPainter> | ||||
| #include <QtGui/QPaintEvent> | |||||
| LEDButton::LEDButton(QWidget* parent): | LEDButton::LEDButton(QWidget* parent): | ||||
| QPushButton(parent) | QPushButton(parent) | ||||
| { | { | ||||
| m_pixmap_rect = QRectF(0, 0, 0, 0); | |||||
| fPixmapRect = QRectF(0, 0, 0, 0); | |||||
| setCheckable(true); | setCheckable(true); | ||||
| setText(""); | setText(""); | ||||
| @@ -36,22 +37,10 @@ LEDButton::~LEDButton() | |||||
| void LEDButton::setColor(Color color) | void LEDButton::setColor(Color color) | ||||
| { | { | ||||
| m_color = color; | |||||
| fColor = color; | |||||
| int size = 14; | |||||
| int size; | |||||
| if (1) //color in (self.BLUE, self.GREEN, self.RED, self.YELLOW): | |||||
| size = 14; | |||||
| else if (color == BIG_RED) | |||||
| size = 64; | |||||
| else | |||||
| return qCritical("LEDButton::setColor(%i) - Invalid color", color); | |||||
| setPixmapSize(size); | |||||
| } | |||||
| void LEDButton::setPixmapSize(int size) | |||||
| { | |||||
| m_pixmap_rect = QRectF(0, 0, size, size); | |||||
| fPixmapRect = QRectF(0, 0, size, size); | |||||
| setMinimumWidth(size); | setMinimumWidth(size); | ||||
| setMaximumWidth(size); | setMaximumWidth(size); | ||||
| @@ -59,34 +48,31 @@ void LEDButton::setPixmapSize(int size) | |||||
| setMaximumHeight(size); | setMaximumHeight(size); | ||||
| } | } | ||||
| void LEDButton::paintEvent(QPaintEvent*) | |||||
| void LEDButton::paintEvent(QPaintEvent* event) | |||||
| { | { | ||||
| QPainter painter(this); | QPainter painter(this); | ||||
| event->accept(); | |||||
| if (isChecked()) | if (isChecked()) | ||||
| { | { | ||||
| if (m_color == BLUE) | |||||
| m_pixmap.load(":/bitmaps/led_blue.png"); | |||||
| else if (m_color == GREEN) | |||||
| m_pixmap.load(":/bitmaps/led_green.png"); | |||||
| else if (m_color == RED) | |||||
| m_pixmap.load(":/bitmaps/led_red.png"); | |||||
| else if (m_color == YELLOW) | |||||
| m_pixmap.load(":/bitmaps/led_yellow.png"); | |||||
| else if (m_color == BIG_RED) | |||||
| m_pixmap.load(":/bitmaps/led-big_on.png"); | |||||
| else | |||||
| switch (fColor) | |||||
| { | |||||
| case BLUE: | |||||
| fPixmap.load(":/bitmaps/led_blue.png"); | |||||
| case GREEN: | |||||
| fPixmap.load(":/bitmaps/led_green.png"); | |||||
| case RED: | |||||
| fPixmap.load(":/bitmaps/led_red.png"); | |||||
| case YELLOW: | |||||
| fPixmap.load(":/bitmaps/led_yellow.png"); | |||||
| default: | |||||
| return; | return; | ||||
| } | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| if (1) //self.m_color in (self.BLUE, self.GREEN, self.RED, self.YELLOW): | |||||
| m_pixmap.load(":/bitmaps/led_off.png"); | |||||
| else if (m_color == BIG_RED) | |||||
| m_pixmap.load(":/bitmaps/led-big_off.png"); | |||||
| else | |||||
| return; | |||||
| fPixmap.load(":/bitmaps/led_off.png"); | |||||
| } | } | ||||
| painter.drawPixmap(m_pixmap_rect, m_pixmap, m_pixmap_rect); | |||||
| painter.drawPixmap(fPixmapRect, fPixmap, fPixmapRect); | |||||
| } | } | ||||
| @@ -35,8 +35,7 @@ public: | |||||
| BLUE = 1, | BLUE = 1, | ||||
| GREEN = 2, | GREEN = 2, | ||||
| RED = 3, | RED = 3, | ||||
| YELLOW = 4, | |||||
| BIG_RED = 5 | |||||
| YELLOW = 4 | |||||
| }; | }; | ||||
| LEDButton(QWidget* parent); | LEDButton(QWidget* parent); | ||||
| @@ -45,15 +44,12 @@ public: | |||||
| void setColor(Color color); | void setColor(Color color); | ||||
| protected: | protected: | ||||
| void setPixmapSize(int size); | |||||
| void paintEvent(QPaintEvent* event); | void paintEvent(QPaintEvent* event); | ||||
| private: | private: | ||||
| QPixmap m_pixmap; | |||||
| QRectF m_pixmap_rect; | |||||
| Color m_color; | |||||
| Color fColor; | |||||
| QPixmap fPixmap; | |||||
| QRectF fPixmapRect; | |||||
| }; | }; | ||||
| #endif // __LEDBUTTON_HPP__ | #endif // __LEDBUTTON_HPP__ | ||||
| @@ -30,7 +30,6 @@ class LEDButton(QPushButton): | |||||
| GREEN = 2 | GREEN = 2 | ||||
| RED = 3 | RED = 3 | ||||
| YELLOW = 4 | YELLOW = 4 | ||||
| BIG_RED = 5 | |||||
| def __init__(self, parent): | def __init__(self, parent): | ||||
| QPushButton.__init__(self, parent) | QPushButton.__init__(self, parent) | ||||
| @@ -45,17 +44,8 @@ class LEDButton(QPushButton): | |||||
| def setColor(self, color): | def setColor(self, color): | ||||
| self.fColor = color | self.fColor = color | ||||
| size = 14 | |||||
| if color in (self.BLUE, self.GREEN, self.RED, self.YELLOW): | |||||
| size = 14 | |||||
| elif color == self.BIG_RED: | |||||
| size = 32 | |||||
| else: | |||||
| return qCritical("LEDButton::setColor(%i) - Invalid color" % color) | |||||
| self.setPixmapSize(size) | |||||
| def setPixmapSize(self, size): | |||||
| self.fPixmapRect = QRectF(0, 0, size, size) | self.fPixmapRect = QRectF(0, 0, size, size) | ||||
| self.setMinimumSize(size, size) | self.setMinimumSize(size, size) | ||||
| @@ -74,16 +64,9 @@ class LEDButton(QPushButton): | |||||
| self.fPixmap.load(":/bitmaps/led_red.png") | self.fPixmap.load(":/bitmaps/led_red.png") | ||||
| elif self.fColor == self.YELLOW: | elif self.fColor == self.YELLOW: | ||||
| self.fPixmap.load(":/bitmaps/led_yellow.png") | self.fPixmap.load(":/bitmaps/led_yellow.png") | ||||
| elif self.fColor == self.BIG_RED: | |||||
| self.fPixmap.load(":/bitmaps/led-big_on.png") | |||||
| else: | else: | ||||
| return | return | ||||
| else: | else: | ||||
| if self.fColor in (self.BLUE, self.GREEN, self.RED, self.YELLOW): | |||||
| self.fPixmap.load(":/bitmaps/led_off.png") | |||||
| elif self.fColor == self.BIG_RED: | |||||
| self.fPixmap.load(":/bitmaps/led-big_off.png") | |||||
| else: | |||||
| return | |||||
| self.fPixmap.load(":/bitmaps/led_off.png") | |||||
| painter.drawPixmap(self.fPixmapRect, self.fPixmap, self.fPixmapRect) | painter.drawPixmap(self.fPixmapRect, self.fPixmap, self.fPixmapRect) | ||||
| @@ -26,11 +26,6 @@ from PyQt4.QtGui import QPainter, QPixmap, QPushButton | |||||
| # Widget Class | # Widget Class | ||||
| class PixmapButton(QPushButton): | class PixmapButton(QPushButton): | ||||
| STATE_NULL = 0 | |||||
| STATE_NORMAL = 1 | |||||
| STATE_DOWN = 2 | |||||
| STATE_HOVER = 3 | |||||
| def __init__(self, parent): | def __init__(self, parent): | ||||
| QPushButton.__init__(self, parent) | QPushButton.__init__(self, parent) | ||||
| @@ -48,13 +43,13 @@ class PixmapButton(QPushButton): | |||||
| self.fPixmapDown.load(down) | self.fPixmapDown.load(down) | ||||
| self.fPixmapHover.load(hover) | self.fPixmapHover.load(hover) | ||||
| self.setPixmapSize(self.fPixmapNormal.width()) | |||||
| width = self.fPixmapNormal.width() | |||||
| height = self.fPixmapNormal.height() | |||||
| def setPixmapSize(self, size): | |||||
| self.fPixmapRect = QRectF(0, 0, size, size) | |||||
| self.fPixmapRect = QRectF(0, 0, width, height) | |||||
| self.setMinimumSize(size, size) | |||||
| self.setMaximumSize(size, size) | |||||
| self.setMinimumSize(width, height) | |||||
| self.setMaximumSize(width, height) | |||||
| def enterEvent(self, event): | def enterEvent(self, event): | ||||
| self.fIsHovered = True | self.fIsHovered = True | ||||