Skip to content

Commit

Permalink
hotplug: emit a plugin configuration change only when actually needed
Browse files Browse the repository at this point in the history
For now a patch reconnection always succeed, to avoid that annoying error popup
  • Loading branch information
mcallegari committed Nov 6, 2015
1 parent cc02cb3 commit c714003
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions engine/src/inputoutputmap.cpp
Expand Up @@ -676,15 +676,15 @@ void InputOutputMap::slotPluginConfigurationChanged(QLCIOPlugin* plugin)
if (op != NULL && op->plugin() == plugin)
{
QMutexLocker locker(&m_universeMutex);
success = op->reconnect();
/*success = */ op->reconnect();
}

InputPatch* ip = m_universeArray.at(i)->inputPatch();

if (ip != NULL && ip->plugin() == plugin)
{
QMutexLocker locker(&m_universeMutex);
success = ip->reconnect();
/*success = */ ip->reconnect();
}
}

Expand Down
5 changes: 4 additions & 1 deletion plugins/dmxusb/src/dmxusb.cpp
Expand Up @@ -57,6 +57,7 @@ int DMXUSB::capabilities() const

bool DMXUSB::rescanWidgets()
{
int linesCount = m_inputs.count() + m_outputs.count();
m_inputs.clear();
m_outputs.clear();

Expand All @@ -74,6 +75,9 @@ bool DMXUSB::rescanWidgets()
m_inputs.append(widget);
}

if (m_inputs.count() + m_outputs.count() != linesCount)
emit configurationChanged();

return true;
}

Expand Down Expand Up @@ -310,7 +314,6 @@ void DMXUSB::slotDeviceAdded(uint vid, uint pid)
}

rescanWidgets();
emit configurationChanged();
}

void DMXUSB::slotDeviceRemoved(uint vid, uint pid)
Expand Down
4 changes: 3 additions & 1 deletion plugins/hid/hidplugin.cpp
Expand Up @@ -245,6 +245,7 @@ void HIDPlugin::rescanDevices()
/* Treat all devices as dead first, until we find them again. Those
that aren't found, get destroyed at the end of this function. */
QList <HIDDevice*> destroyList(m_devices);
int devCount = m_devices.count();

struct hid_device_info *devs, *cur_dev;
quint32 line = 0;
Expand Down Expand Up @@ -306,7 +307,8 @@ void HIDPlugin::rescanDevices()
delete dev;
}

emit configurationChanged();
if (m_devices.count() != devCount)
emit configurationChanged();
}

HIDDevice* HIDPlugin::device(const QString& path)
Expand Down

0 comments on commit c714003

Please sign in to comment.