mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-09-09 09:09:56 +00:00
initial implementation of custom keys
This commit is contained in:
@ -250,10 +250,11 @@ void AWKeys::reinitKeys(const QStringList &_currentKeys)
|
||||
barKeys.append(item->usedKeys());
|
||||
}
|
||||
// get required keys
|
||||
m_requiredKeys
|
||||
= m_optimize ? AWKeyCache::getRequiredKeys(
|
||||
m_foundKeys, barKeys, m_tooltipParams, _currentKeys)
|
||||
: QStringList();
|
||||
m_requiredKeys = m_optimize
|
||||
? AWKeyCache::getRequiredKeys(
|
||||
m_foundKeys, barKeys, m_tooltipParams,
|
||||
m_keyOperator->requiredUserKeys(), _currentKeys)
|
||||
: QStringList();
|
||||
|
||||
// set key data to m_aggregator
|
||||
m_aggregator->setDevices(m_keyOperator->devices());
|
||||
@ -266,10 +267,11 @@ void AWKeys::updateTextData()
|
||||
m_mutex.lock();
|
||||
calculateValues();
|
||||
QString text = parsePattern(m_keyOperator->pattern());
|
||||
// update tooltip values under lock
|
||||
m_dataAggregator->dataUpdate(m_values);
|
||||
m_mutex.unlock();
|
||||
|
||||
emit(needTextToBeUpdated(text));
|
||||
emit(m_dataAggregator->updateData(m_values));
|
||||
}
|
||||
|
||||
|
||||
@ -321,6 +323,10 @@ void AWKeys::calculateValues()
|
||||
m_values["swap"] = 100.0f * m_values["swapmb"].toFloat()
|
||||
/ m_values["swaptotmb"].toFloat();
|
||||
|
||||
// user defined keys
|
||||
for (auto &key : m_keyOperator->userKeys())
|
||||
m_values[key] = m_values[m_keyOperator->userKeySource(key)];
|
||||
|
||||
// lambdas
|
||||
for (auto &key : m_foundLambdas)
|
||||
m_values[key] = AWPatternFunctions::expandLambdas(
|
||||
|
Reference in New Issue
Block a user