mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-07 02:45:51 +00:00
return back stream lock which will be disabled from qml by the timer. In
other case there is possibe plasma crash
This commit is contained in:
@ -50,11 +50,10 @@ AWKeys::AWKeys(QObject *parent)
|
||||
// thread pool
|
||||
queueLimit = QThread::idealThreadCount();
|
||||
threadPool = new QThreadPool(this);
|
||||
threadPool->setMaxThreadCount(queueLimit);
|
||||
#endif /* BUILD_FUTURE */
|
||||
|
||||
aggregator = new AWKeysAggregator(this);
|
||||
dataAggregator = new AWDataAggregator(this, threadPool);
|
||||
dataAggregator = new AWDataAggregator(this);
|
||||
// transfer signal from AWDataAggregator object to QML ui
|
||||
connect(dataAggregator, SIGNAL(toolTipPainted(const QString)),
|
||||
this, SIGNAL(needToolTipToBeUpdated(const QString)));
|
||||
@ -126,6 +125,14 @@ void AWKeys::setWrapNewLines(const bool wrap)
|
||||
}
|
||||
|
||||
|
||||
void AWKeys::unlock()
|
||||
{
|
||||
qCDebug(LOG_AW);
|
||||
|
||||
lock = false;
|
||||
}
|
||||
|
||||
|
||||
void AWKeys::addDevice(const QString source)
|
||||
{
|
||||
qCDebug(LOG_AW);
|
||||
@ -324,12 +331,11 @@ void AWKeys::dataUpdateReceived(const QString sourceName, const QVariantMap data
|
||||
qCDebug(LOG_AW) << "Source" << sourceName;
|
||||
qCDebug(LOG_AW) << "Data" << data;
|
||||
|
||||
// we will update text even if queue limit is reached
|
||||
if (lock) return;
|
||||
if (sourceName == QString("update")) return emit(needToBeUpdated());
|
||||
|
||||
#ifdef BUILD_FUTURE
|
||||
// run concurrent data update
|
||||
if ((lock = ((lock) && (queue > 0)))) return;
|
||||
QtConcurrent::run(threadPool, [this, sourceName, data]() {
|
||||
return setDataBySource(sourceName, data);
|
||||
});
|
||||
@ -682,6 +688,7 @@ void AWKeys::setDataBySource(const QString sourceName, const QVariantMap data)
|
||||
if (++queue > queueLimit) {
|
||||
qCWarning(LOG_AW) << "Messages queue" << queue-- << "more than limits" << queueLimit;
|
||||
lock = true;
|
||||
emit(disconnectPlugin());
|
||||
return;
|
||||
}
|
||||
#endif /* BUILD_FUTURE */
|
||||
|
Reference in New Issue
Block a user