Merge PR #199: Boblight: Fix behavior if color is changed very fast
commit
b2f524c63f
|
|
@ -26,7 +26,6 @@ BobChannel::BobChannel(const int &id, QObject *parent) :
|
|||
{
|
||||
m_animation = new QPropertyAnimation(this, "finalColor", this);
|
||||
m_animation->setDuration(500);
|
||||
m_animation->setEasingCurve(QEasingCurve::InOutQuad);
|
||||
}
|
||||
|
||||
int BobChannel::id() const
|
||||
|
|
@ -41,13 +40,14 @@ QColor BobChannel::color() const
|
|||
|
||||
void BobChannel::setColor(const QColor &color)
|
||||
{
|
||||
m_color = color;
|
||||
emit colorChanged();
|
||||
|
||||
if (m_animation->state() == QPropertyAnimation::Running) {
|
||||
m_animation->stop();
|
||||
m_finalColor = m_color;
|
||||
}
|
||||
|
||||
m_color = color;
|
||||
emit colorChanged();
|
||||
|
||||
m_animation->setStartValue(m_finalColor);
|
||||
m_animation->setEndValue(color);
|
||||
m_animation->start();
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ BobClient::BobClient(const QString &host, const int &port, QObject *parent) :
|
|||
{
|
||||
m_syncTimer = new QTimer(this);
|
||||
m_syncTimer->setSingleShot(false);
|
||||
m_syncTimer->setInterval(50);
|
||||
m_syncTimer->setInterval(25);
|
||||
|
||||
connect(m_syncTimer, SIGNAL(timeout()), this, SLOT(sync()));
|
||||
}
|
||||
|
|
@ -103,7 +103,7 @@ BobChannel *BobClient::getChannel(const int &id)
|
|||
if (channel->id() == id)
|
||||
return channel;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void BobClient::setColor(int channel, QColor color)
|
||||
|
|
@ -148,7 +148,7 @@ void BobClient::sync()
|
|||
boblight_addpixel(m_boblight, channel->id(), rgb);
|
||||
}
|
||||
|
||||
if (!boblight_sendrgb(m_boblight, 1, NULL)) {
|
||||
if (!boblight_sendrgb(m_boblight, 1, nullptr)) {
|
||||
qCWarning(dcBoblight) << "Boblight connection error:" << boblight_geterror(m_boblight);
|
||||
boblight_destroy(m_boblight);
|
||||
qDeleteAll(m_channels);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class BobClient : public QObject
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BobClient(const QString &host = "127.0.0.1", const int &port = 19333, QObject *parent = 0);
|
||||
explicit BobClient(const QString &host = "127.0.0.1", const int &port = 19333, QObject *parent = nullptr);
|
||||
~BobClient();
|
||||
|
||||
bool connectToBoblight();
|
||||
|
|
|
|||
|
|
@ -58,12 +58,12 @@ void DevicePluginBoblight::startMonitoringAutoDevices()
|
|||
foreach (Device *device, myDevices()) {
|
||||
deviceIds.insert(device->id(), device);
|
||||
if (device->deviceClassId() == boblightServerDeviceClassId) {
|
||||
qWarning() << "Device" << device->id() << "is bridge";
|
||||
// qWarning() << "Device" << device->id() << "is bridge";
|
||||
if (!parentDevices.contains(device->id())) {
|
||||
parentDevices[device->id()] = 0;
|
||||
}
|
||||
} else if (device->deviceClassId() == boblightDeviceClassId) {
|
||||
qWarning() << "Device" << device->id() << "is child to bridge" << device->parentId();
|
||||
// qWarning() << "Device" << device->id() << "is child to bridge" << device->parentId();
|
||||
parentDevices[device->parentId()] += 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue