mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-09 20:05:51 +00:00
use m_ prefix for all internal variables, update CONTRIBUTING.md
accordingly
This commit is contained in:
@ -36,13 +36,13 @@ AWDataAggregator::AWDataAggregator(QObject *parent)
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
|
||||
boundaries[QString("cpuTooltip")] = 100.0;
|
||||
boundaries[QString("cpuclTooltip")] = 4000.0;
|
||||
boundaries[QString("memTooltip")] = 100.0;
|
||||
boundaries[QString("swapTooltip")] = 100.0;
|
||||
boundaries[QString("downkbTooltip")] = 1.0;
|
||||
boundaries[QString("upkbTooltip")] = 1.0;
|
||||
boundaries[QString("batTooltip")] = 100.0;
|
||||
m_boundaries[QString("cpuTooltip")] = 100.0;
|
||||
m_boundaries[QString("cpuclTooltip")] = 4000.0;
|
||||
m_boundaries[QString("memTooltip")] = 100.0;
|
||||
m_boundaries[QString("swapTooltip")] = 100.0;
|
||||
m_boundaries[QString("downkbTooltip")] = 1.0;
|
||||
m_boundaries[QString("upkbTooltip")] = 1.0;
|
||||
m_boundaries[QString("batTooltip")] = 100.0;
|
||||
|
||||
initScene();
|
||||
connect(this, SIGNAL(updateData(const QVariantHash &)), this,
|
||||
@ -54,7 +54,7 @@ AWDataAggregator::~AWDataAggregator()
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
|
||||
delete toolTipScene;
|
||||
delete m_toolTipScene;
|
||||
}
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ QList<float> AWDataAggregator::getData(const QString key) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Key" << key;
|
||||
|
||||
return data[QString("%1Tooltip").arg(key)];
|
||||
return m_values[QString("%1Tooltip").arg(key)];
|
||||
}
|
||||
|
||||
|
||||
@ -84,41 +84,41 @@ void AWDataAggregator::setParameters(QVariantMap settings)
|
||||
qCDebug(LOG_AW) << "Settings" << settings;
|
||||
|
||||
// cast from QVariantMap to QVariantHash without data lost
|
||||
configuration = qvariant_cast<QVariantHash>(settings);
|
||||
m_configuration = qvariant_cast<QVariantHash>(settings);
|
||||
|
||||
m_enablePopup = configuration[QString("notify")].toBool();
|
||||
m_enablePopup = m_configuration[QString("notify")].toBool();
|
||||
|
||||
counts = 0;
|
||||
counts += configuration[QString("cpuTooltip")].toInt();
|
||||
counts += configuration[QString("cpuclTooltip")].toInt();
|
||||
counts += configuration[QString("memTooltip")].toInt();
|
||||
counts += configuration[QString("swapTooltip")].toInt();
|
||||
counts += configuration[QString("downkbTooltip")].toInt();
|
||||
counts += configuration[QString("batTooltip")].toInt();
|
||||
m_counts = 0;
|
||||
m_counts += m_configuration[QString("cpuTooltip")].toInt();
|
||||
m_counts += m_configuration[QString("cpuclTooltip")].toInt();
|
||||
m_counts += m_configuration[QString("memTooltip")].toInt();
|
||||
m_counts += m_configuration[QString("swapTooltip")].toInt();
|
||||
m_counts += m_configuration[QString("downkbTooltip")].toInt();
|
||||
m_counts += m_configuration[QString("batTooltip")].toInt();
|
||||
// resize tooltip image
|
||||
toolTipView->resize(100 * counts, 105);
|
||||
m_toolTipView->resize(100 * m_counts, 105);
|
||||
|
||||
requiredKeys.clear();
|
||||
if (configuration[QString("cpuTooltip")].toBool())
|
||||
if (m_configuration[QString("cpuTooltip")].toBool())
|
||||
requiredKeys.append(QString("cpuTooltip"));
|
||||
if (configuration[QString("cpuclTooltip")].toBool())
|
||||
if (m_configuration[QString("cpuclTooltip")].toBool())
|
||||
requiredKeys.append(QString("cpuclTooltip"));
|
||||
if (configuration[QString("memTooltip")].toBool())
|
||||
if (m_configuration[QString("memTooltip")].toBool())
|
||||
requiredKeys.append(QString("memTooltip"));
|
||||
if (configuration[QString("swapTooltip")].toBool())
|
||||
if (m_configuration[QString("swapTooltip")].toBool())
|
||||
requiredKeys.append(QString("swapTooltip"));
|
||||
if (configuration[QString("downkbTooltip")].toBool())
|
||||
if (m_configuration[QString("downkbTooltip")].toBool())
|
||||
requiredKeys.append(QString("downkbTooltip"));
|
||||
if (configuration[QString("upkbTooltip")].toBool())
|
||||
if (m_configuration[QString("upkbTooltip")].toBool())
|
||||
requiredKeys.append(QString("upkbTooltip"));
|
||||
if (configuration[QString("batTooltip")].toBool())
|
||||
if (m_configuration[QString("batTooltip")].toBool())
|
||||
requiredKeys.append(QString("batTooltip"));
|
||||
|
||||
// background
|
||||
toolTipScene->setBackgroundBrush(
|
||||
configuration[QString("useTooltipBackground")].toBool()
|
||||
m_toolTipScene->setBackgroundBrush(
|
||||
m_configuration[QString("useTooltipBackground")].toBool()
|
||||
? QBrush(QColor(
|
||||
configuration[QString("tooltipBackground")].toString()))
|
||||
m_configuration[QString("tooltipBackground")].toString()))
|
||||
: QBrush(Qt::NoBrush));
|
||||
}
|
||||
|
||||
@ -126,43 +126,44 @@ void AWDataAggregator::setParameters(QVariantMap settings)
|
||||
QPixmap AWDataAggregator::tooltipImage()
|
||||
{
|
||||
// create image
|
||||
toolTipScene->clear();
|
||||
m_toolTipScene->clear();
|
||||
QPen pen;
|
||||
bool down = false;
|
||||
for (auto key : requiredKeys) {
|
||||
// create frame
|
||||
float normX = 100.0f / static_cast<float>(data[key].count());
|
||||
float normY = 100.0f / (1.5f * boundaries[key]);
|
||||
float normX = 100.0f / static_cast<float>(m_values[key].count());
|
||||
float normY = 100.0f / (1.5f * m_boundaries[key]);
|
||||
float shift = requiredKeys.indexOf(key) * 100.0f;
|
||||
if (down)
|
||||
shift -= 100.0;
|
||||
// apply pen color
|
||||
if (key != QString("batTooltip"))
|
||||
pen.setColor(
|
||||
QColor(configuration[QString("%1Color").arg(key)].toString()));
|
||||
pen.setColor(QColor(
|
||||
m_configuration[QString("%1Color").arg(key)].toString()));
|
||||
// paint data inside frame
|
||||
for (int j = 0; j < data[key].count() - 1; j++) {
|
||||
for (int j = 0; j < m_values[key].count() - 1; j++) {
|
||||
// some magic here
|
||||
float x1 = j * normX + shift;
|
||||
float y1 = -fabs(data[key].at(j)) * normY + 5.0f;
|
||||
float y1 = -fabs(m_values[key].at(j)) * normY + 5.0f;
|
||||
float x2 = (j + 1) * normX + shift;
|
||||
float y2 = -fabs(data[key].at(j + 1)) * normY + 5.0f;
|
||||
float y2 = -fabs(m_values[key].at(j + 1)) * normY + 5.0f;
|
||||
if (key == QString("batTooltip")) {
|
||||
if (data[key].at(j + 1) > 0)
|
||||
pen.setColor(QColor(
|
||||
configuration[QString("batTooltipColor")].toString()));
|
||||
if (m_values[key].at(j + 1) > 0)
|
||||
pen.setColor(
|
||||
QColor(m_configuration[QString("batTooltipColor")]
|
||||
.toString()));
|
||||
else
|
||||
pen.setColor(
|
||||
QColor(configuration[QString("batInTooltipColor")]
|
||||
QColor(m_configuration[QString("batInTooltipColor")]
|
||||
.toString()));
|
||||
}
|
||||
toolTipScene->addLine(x1, y1, x2, y2, pen);
|
||||
m_toolTipScene->addLine(x1, y1, x2, y2, pen);
|
||||
}
|
||||
if (key == QString("downkbTooltip"))
|
||||
down = true;
|
||||
}
|
||||
|
||||
return toolTipView->grab();
|
||||
return m_toolTipView->grab();
|
||||
}
|
||||
|
||||
|
||||
@ -182,12 +183,12 @@ void AWDataAggregator::checkValue(const QString source, const float value,
|
||||
|
||||
if (value >= 0.0) {
|
||||
if ((m_enablePopup) && (value > extremum)
|
||||
&& (data[source].last() < extremum))
|
||||
&& (m_values[source].last() < extremum))
|
||||
return AWActions::sendNotification(QString("event"),
|
||||
notificationText(source, value));
|
||||
} else {
|
||||
if ((m_enablePopup) && (value < extremum)
|
||||
&& (data[source].last() > extremum))
|
||||
&& (m_values[source].last() > extremum))
|
||||
return AWActions::sendNotification(QString("event"),
|
||||
notificationText(source, value));
|
||||
}
|
||||
@ -208,13 +209,13 @@ void AWDataAggregator::checkValue(const QString source, const QString current,
|
||||
|
||||
void AWDataAggregator::initScene()
|
||||
{
|
||||
toolTipScene = new QGraphicsScene(nullptr);
|
||||
toolTipView = new QGraphicsView(toolTipScene);
|
||||
toolTipView->setStyleSheet(QString("background: transparent"));
|
||||
toolTipView->setContentsMargins(0, 0, 0, 0);
|
||||
toolTipView->setFrameShape(QFrame::NoFrame);
|
||||
toolTipView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
toolTipView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_toolTipScene = new QGraphicsScene(nullptr);
|
||||
m_toolTipView = new QGraphicsView(m_toolTipScene);
|
||||
m_toolTipView->setStyleSheet(QString("background: transparent"));
|
||||
m_toolTipView->setContentsMargins(0, 0, 0, 0);
|
||||
m_toolTipView->setFrameShape(QFrame::NoFrame);
|
||||
m_toolTipView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_toolTipView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
}
|
||||
|
||||
|
||||
@ -257,7 +258,7 @@ void AWDataAggregator::setData(const QVariantHash &values)
|
||||
// do not log these arguments
|
||||
// battery update requires info is AC online or not
|
||||
setData(values[QString("ac")].toString()
|
||||
== configuration[QString("acOnline")],
|
||||
== m_configuration[QString("acOnline")],
|
||||
QString("batTooltip"), values[QString("bat")].toFloat());
|
||||
// usual case
|
||||
setData(QString("cpuTooltip"), values[QString("cpu")].toFloat(), 90.0);
|
||||
@ -268,13 +269,13 @@ void AWDataAggregator::setData(const QVariantHash &values)
|
||||
setData(QString("upkbTooltip"), values[QString("upkb")].toFloat());
|
||||
// additional check for network device
|
||||
[this](const QString value) {
|
||||
checkValue(QString("netdev"), currentNetworkDevice, value);
|
||||
currentNetworkDevice = value;
|
||||
checkValue(QString("netdev"), m_currentNetworkDevice, value);
|
||||
m_currentNetworkDevice = value;
|
||||
}(values[QString("netdev")].toString());
|
||||
// additional check for GPU load
|
||||
[this](const float value) {
|
||||
checkValue(QString("gpu"), value, 90.0);
|
||||
currentGPULoad = value;
|
||||
m_currentGPULoad = value;
|
||||
}(values[QString("gpu")].toFloat());
|
||||
}
|
||||
|
||||
@ -285,27 +286,27 @@ void AWDataAggregator::setData(const QString &source, float value,
|
||||
qCDebug(LOG_AW) << "Source" << source << "to value" << value
|
||||
<< "with extremum" << extremum;
|
||||
|
||||
if (data[source].count() == 0)
|
||||
data[source].append(0.0);
|
||||
else if (data[source].count()
|
||||
> configuration[QString("tooltipNumber")].toInt())
|
||||
data[source].removeFirst();
|
||||
if (m_values[source].count() == 0)
|
||||
m_values[source].append(0.0);
|
||||
else if (m_values[source].count()
|
||||
> m_configuration[QString("tooltipNumber")].toInt())
|
||||
m_values[source].removeFirst();
|
||||
if (std::isnan(value))
|
||||
value = 0.0;
|
||||
|
||||
// notifications
|
||||
checkValue(source, value, extremum);
|
||||
|
||||
data[source].append(value);
|
||||
m_values[source].append(value);
|
||||
if (source == QString("downkbTooltip")) {
|
||||
QList<float> netValues
|
||||
= data[QString("downkbTooltip")] + data[QString("upkbTooltip")];
|
||||
QList<float> netValues = m_values[QString("downkbTooltip")]
|
||||
+ m_values[QString("upkbTooltip")];
|
||||
// to avoid inf value of normY
|
||||
netValues << 1.0;
|
||||
boundaries[QString("downkbTooltip")]
|
||||
m_boundaries[QString("downkbTooltip")]
|
||||
= 1.2f * *std::max_element(netValues.cbegin(), netValues.cend());
|
||||
boundaries[QString("upkbTooltip")]
|
||||
= boundaries[QString("downkbTooltip")];
|
||||
m_boundaries[QString("upkbTooltip")]
|
||||
= m_boundaries[QString("downkbTooltip")];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,8 +49,8 @@ private slots:
|
||||
|
||||
private:
|
||||
// ui
|
||||
QGraphicsScene *toolTipScene = nullptr;
|
||||
QGraphicsView *toolTipView = nullptr;
|
||||
QGraphicsScene *m_toolTipScene = nullptr;
|
||||
QGraphicsView *m_toolTipView = nullptr;
|
||||
void checkValue(const QString source, const float value,
|
||||
const float extremum) const;
|
||||
void checkValue(const QString source, const QString current,
|
||||
@ -65,12 +65,12 @@ private:
|
||||
// different signature for battery device
|
||||
void setData(const bool dontInvert, const QString &source, float value);
|
||||
// variables
|
||||
int counts = 0;
|
||||
QVariantHash configuration;
|
||||
float currentGPULoad = 0.0;
|
||||
QString currentNetworkDevice = QString("lo");
|
||||
QHash<QString, float> boundaries;
|
||||
QHash<QString, QList<float>> data;
|
||||
int m_counts = 0;
|
||||
QVariantHash m_configuration;
|
||||
float m_currentGPULoad = 0.0;
|
||||
QString m_currentNetworkDevice = QString("lo");
|
||||
QHash<QString, float> m_boundaries;
|
||||
QHash<QString, QList<float>> m_values;
|
||||
bool m_enablePopup = false;
|
||||
QStringList requiredKeys;
|
||||
};
|
||||
|
@ -35,13 +35,13 @@ AWFormatterConfig::AWFormatterConfig(QWidget *parent, const QStringList keys)
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
|
||||
ui->setupUi(this);
|
||||
editButton
|
||||
m_editButton
|
||||
= ui->buttonBox->addButton(i18n("Edit"), QDialogButtonBox::ActionRole);
|
||||
init();
|
||||
|
||||
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
connect(editButton, SIGNAL(clicked(bool)), this, SLOT(editFormatters()));
|
||||
connect(m_editButton, SIGNAL(clicked(bool)), this, SLOT(editFormatters()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -44,7 +44,7 @@ private slots:
|
||||
void updateUi();
|
||||
|
||||
private:
|
||||
QPushButton *editButton = nullptr;
|
||||
QPushButton *m_editButton = nullptr;
|
||||
Ui::AWFormatterConfig *ui = nullptr;
|
||||
AWFormatterHelper *m_helper = nullptr;
|
||||
QList<AWAbstractSelector *> m_selectors;
|
||||
|
@ -45,11 +45,11 @@ AWKeyOperations::~AWKeyOperations()
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
|
||||
// extensions
|
||||
delete graphicalItems;
|
||||
delete extQuotes;
|
||||
delete extScripts;
|
||||
delete extUpgrade;
|
||||
delete extWeather;
|
||||
delete m_graphicalItems;
|
||||
delete m_extQuotes;
|
||||
delete m_extScripts;
|
||||
delete m_extUpgrade;
|
||||
delete m_extWeather;
|
||||
}
|
||||
|
||||
|
||||
@ -79,19 +79,19 @@ QStringList AWKeyOperations::dictKeys() const
|
||||
{
|
||||
QStringList allKeys;
|
||||
// weather
|
||||
for (int i = extWeather->activeItems().count() - 1; i >= 0; i--) {
|
||||
for (int i = m_extWeather->activeItems().count() - 1; i >= 0; i--) {
|
||||
allKeys.append(
|
||||
extWeather->activeItems().at(i)->tag(QString("weatherId")));
|
||||
m_extWeather->activeItems().at(i)->tag(QString("weatherId")));
|
||||
allKeys.append(
|
||||
extWeather->activeItems().at(i)->tag(QString("weather")));
|
||||
m_extWeather->activeItems().at(i)->tag(QString("weather")));
|
||||
allKeys.append(
|
||||
extWeather->activeItems().at(i)->tag(QString("humidity")));
|
||||
m_extWeather->activeItems().at(i)->tag(QString("humidity")));
|
||||
allKeys.append(
|
||||
extWeather->activeItems().at(i)->tag(QString("pressure")));
|
||||
m_extWeather->activeItems().at(i)->tag(QString("pressure")));
|
||||
allKeys.append(
|
||||
extWeather->activeItems().at(i)->tag(QString("temperature")));
|
||||
m_extWeather->activeItems().at(i)->tag(QString("temperature")));
|
||||
allKeys.append(
|
||||
extWeather->activeItems().at(i)->tag(QString("timestamp")));
|
||||
m_extWeather->activeItems().at(i)->tag(QString("timestamp")));
|
||||
}
|
||||
// cpuclock & cpu
|
||||
for (int i = QThread::idealThreadCount() - 1; i >= 0; i--) {
|
||||
@ -140,32 +140,35 @@ QStringList AWKeyOperations::dictKeys() const
|
||||
for (int i = allBatteryDevices.count() - 1; i >= 0; i--)
|
||||
allKeys.append(QString("bat%1").arg(i));
|
||||
// package manager
|
||||
for (int i = extUpgrade->activeItems().count() - 1; i >= 0; i--)
|
||||
for (int i = m_extUpgrade->activeItems().count() - 1; i >= 0; i--)
|
||||
allKeys.append(
|
||||
extUpgrade->activeItems().at(i)->tag(QString("pkgcount")));
|
||||
m_extUpgrade->activeItems().at(i)->tag(QString("pkgcount")));
|
||||
// quotes
|
||||
for (int i = extQuotes->activeItems().count() - 1; i >= 0; i--) {
|
||||
allKeys.append(extQuotes->activeItems().at(i)->tag(QString("ask")));
|
||||
allKeys.append(extQuotes->activeItems().at(i)->tag(QString("askchg")));
|
||||
for (int i = m_extQuotes->activeItems().count() - 1; i >= 0; i--) {
|
||||
allKeys.append(m_extQuotes->activeItems().at(i)->tag(QString("ask")));
|
||||
allKeys.append(
|
||||
extQuotes->activeItems().at(i)->tag(QString("percaskchg")));
|
||||
allKeys.append(extQuotes->activeItems().at(i)->tag(QString("bid")));
|
||||
allKeys.append(extQuotes->activeItems().at(i)->tag(QString("bidchg")));
|
||||
m_extQuotes->activeItems().at(i)->tag(QString("askchg")));
|
||||
allKeys.append(
|
||||
extQuotes->activeItems().at(i)->tag(QString("percbidchg")));
|
||||
allKeys.append(extQuotes->activeItems().at(i)->tag(QString("price")));
|
||||
m_extQuotes->activeItems().at(i)->tag(QString("percaskchg")));
|
||||
allKeys.append(m_extQuotes->activeItems().at(i)->tag(QString("bid")));
|
||||
allKeys.append(
|
||||
extQuotes->activeItems().at(i)->tag(QString("pricechg")));
|
||||
m_extQuotes->activeItems().at(i)->tag(QString("bidchg")));
|
||||
allKeys.append(
|
||||
extQuotes->activeItems().at(i)->tag(QString("percpricechg")));
|
||||
m_extQuotes->activeItems().at(i)->tag(QString("percbidchg")));
|
||||
allKeys.append(m_extQuotes->activeItems().at(i)->tag(QString("price")));
|
||||
allKeys.append(
|
||||
m_extQuotes->activeItems().at(i)->tag(QString("pricechg")));
|
||||
allKeys.append(
|
||||
m_extQuotes->activeItems().at(i)->tag(QString("percpricechg")));
|
||||
}
|
||||
// custom
|
||||
for (int i = extScripts->activeItems().count() - 1; i >= 0; i--)
|
||||
allKeys.append(extScripts->activeItems().at(i)->tag(QString("custom")));
|
||||
// bars
|
||||
for (int i = graphicalItems->activeItems().count() - 1; i >= 0; i--)
|
||||
for (int i = m_extScripts->activeItems().count() - 1; i >= 0; i--)
|
||||
allKeys.append(
|
||||
graphicalItems->activeItems().at(i)->tag(QString("bar")));
|
||||
m_extScripts->activeItems().at(i)->tag(QString("custom")));
|
||||
// bars
|
||||
for (int i = m_graphicalItems->activeItems().count() - 1; i >= 0; i--)
|
||||
allKeys.append(
|
||||
m_graphicalItems->activeItems().at(i)->tag(QString("bar")));
|
||||
// static keys
|
||||
QStringList staticKeys = QString(STATIC_KEYS).split(QChar(','));
|
||||
std::for_each(staticKeys.cbegin(), staticKeys.cend(),
|
||||
@ -181,7 +184,7 @@ GraphicalItem *AWKeyOperations::giByKey(const QString key) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Looking for item" << key;
|
||||
|
||||
return graphicalItems->itemByTag(key, QString("bar"));
|
||||
return m_graphicalItems->itemByTag(key, QString("bar"));
|
||||
}
|
||||
|
||||
|
||||
@ -194,11 +197,11 @@ QString AWKeyOperations::infoByKey(QString key) const
|
||||
QString output;
|
||||
|
||||
if (key.startsWith(QString("bar"))) {
|
||||
AbstractExtItem *item = graphicalItems->itemByTag(key, stripped);
|
||||
AbstractExtItem *item = m_graphicalItems->itemByTag(key, stripped);
|
||||
if (item)
|
||||
output = item->uniq();
|
||||
} else if (key.startsWith(QString("custom"))) {
|
||||
AbstractExtItem *item = extScripts->itemByTag(key, stripped);
|
||||
AbstractExtItem *item = m_extScripts->itemByTag(key, stripped);
|
||||
if (item)
|
||||
output = item->uniq();
|
||||
} else if (key.contains(QRegExp(QString("^hdd[rw]")))) {
|
||||
@ -219,17 +222,17 @@ QString AWKeyOperations::infoByKey(QString key) const
|
||||
output = m_devices[QString("net")]
|
||||
[key.remove(QRegExp(QString("^(down|up)"))).toInt()];
|
||||
} else if (key.startsWith(QString("pkgcount"))) {
|
||||
AbstractExtItem *item = extUpgrade->itemByTag(key, stripped);
|
||||
AbstractExtItem *item = m_extUpgrade->itemByTag(key, stripped);
|
||||
if (item)
|
||||
output = item->uniq();
|
||||
} else if (key.contains(
|
||||
QRegExp(QString("(^|perc)(ask|bid|price)(chg|)")))) {
|
||||
AbstractExtItem *item = extQuotes->itemByTag(key, stripped);
|
||||
AbstractExtItem *item = m_extQuotes->itemByTag(key, stripped);
|
||||
if (item)
|
||||
output = item->uniq();
|
||||
} else if (key.contains(QRegExp(QString(
|
||||
"(weather|weatherId|humidity|pressure|temperature)")))) {
|
||||
AbstractExtItem *item = extWeather->itemByTag(key, stripped);
|
||||
AbstractExtItem *item = m_extWeather->itemByTag(key, stripped);
|
||||
if (item)
|
||||
output = item->uniq();
|
||||
} else if (key.startsWith(QString("temp"))) {
|
||||
@ -265,16 +268,16 @@ void AWKeyOperations::editItem(const QString type)
|
||||
QStringList keys = dictKeys().filter(QRegExp(
|
||||
QString("^(cpu(?!cl).*|gpu$|mem$|swap$|hdd[0-9].*|bat.*)")));
|
||||
keys.sort();
|
||||
graphicalItems->setConfigArgs(keys);
|
||||
return graphicalItems->editItems();
|
||||
m_graphicalItems->setConfigArgs(keys);
|
||||
return m_graphicalItems->editItems();
|
||||
} else if (type == QString("extquotes")) {
|
||||
return extQuotes->editItems();
|
||||
return m_extQuotes->editItems();
|
||||
} else if (type == QString("extscript")) {
|
||||
return extScripts->editItems();
|
||||
return m_extScripts->editItems();
|
||||
} else if (type == QString("extupgrade")) {
|
||||
return extUpgrade->editItems();
|
||||
return m_extUpgrade->editItems();
|
||||
} else if (type == QString("extweather")) {
|
||||
return extWeather->editItems();
|
||||
return m_extWeather->editItems();
|
||||
}
|
||||
}
|
||||
|
||||
@ -316,23 +319,26 @@ void AWKeyOperations::reinitKeys()
|
||||
{
|
||||
// renew extensions
|
||||
// delete them if any
|
||||
delete graphicalItems;
|
||||
graphicalItems = nullptr;
|
||||
delete extQuotes;
|
||||
extQuotes = nullptr;
|
||||
delete extScripts;
|
||||
extScripts = nullptr;
|
||||
delete extUpgrade;
|
||||
extUpgrade = nullptr;
|
||||
delete extWeather;
|
||||
extWeather = nullptr;
|
||||
delete m_graphicalItems;
|
||||
m_graphicalItems = nullptr;
|
||||
delete m_extQuotes;
|
||||
m_extQuotes = nullptr;
|
||||
delete m_extScripts;
|
||||
m_extScripts = nullptr;
|
||||
delete m_extUpgrade;
|
||||
m_extUpgrade = nullptr;
|
||||
delete m_extWeather;
|
||||
m_extWeather = nullptr;
|
||||
// create
|
||||
graphicalItems
|
||||
m_graphicalItems
|
||||
= new ExtItemAggregator<GraphicalItem>(nullptr, QString("desktops"));
|
||||
extQuotes = new ExtItemAggregator<ExtQuotes>(nullptr, QString("quotes"));
|
||||
extScripts = new ExtItemAggregator<ExtScript>(nullptr, QString("scripts"));
|
||||
extUpgrade = new ExtItemAggregator<ExtUpgrade>(nullptr, QString("upgrade"));
|
||||
extWeather = new ExtItemAggregator<ExtWeather>(nullptr, QString("weather"));
|
||||
m_extQuotes = new ExtItemAggregator<ExtQuotes>(nullptr, QString("quotes"));
|
||||
m_extScripts
|
||||
= new ExtItemAggregator<ExtScript>(nullptr, QString("scripts"));
|
||||
m_extUpgrade
|
||||
= new ExtItemAggregator<ExtUpgrade>(nullptr, QString("upgrade"));
|
||||
m_extWeather
|
||||
= new ExtItemAggregator<ExtWeather>(nullptr, QString("weather"));
|
||||
|
||||
// init
|
||||
QStringList allKeys = dictKeys();
|
||||
|
@ -69,11 +69,11 @@ private:
|
||||
void addKeyToCache(const QString type, const QString key = QString(""));
|
||||
void reinitKeys();
|
||||
// objects
|
||||
ExtItemAggregator<GraphicalItem> *graphicalItems = nullptr;
|
||||
ExtItemAggregator<ExtQuotes> *extQuotes = nullptr;
|
||||
ExtItemAggregator<ExtScript> *extScripts = nullptr;
|
||||
ExtItemAggregator<ExtUpgrade> *extUpgrade = nullptr;
|
||||
ExtItemAggregator<ExtWeather> *extWeather = nullptr;
|
||||
ExtItemAggregator<GraphicalItem> *m_graphicalItems = nullptr;
|
||||
ExtItemAggregator<ExtQuotes> *m_extQuotes = nullptr;
|
||||
ExtItemAggregator<ExtScript> *m_extScripts = nullptr;
|
||||
ExtItemAggregator<ExtUpgrade> *m_extUpgrade = nullptr;
|
||||
ExtItemAggregator<ExtWeather> *m_extWeather = nullptr;
|
||||
// variables
|
||||
QHash<QString, QStringList> m_devices;
|
||||
QString m_pattern;
|
||||
|
@ -44,26 +44,26 @@ AWKeys::AWKeys(QObject *parent)
|
||||
// thread pool
|
||||
m_threadPool = new QThreadPool(this);
|
||||
|
||||
aggregator = new AWKeysAggregator(this);
|
||||
dataAggregator = new AWDataAggregator(this);
|
||||
dataEngineAggregator = new AWDataEngineAggregator(this);
|
||||
keyOperator = new AWKeyOperations(this);
|
||||
m_aggregator = new AWKeysAggregator(this);
|
||||
m_dataAggregator = new AWDataAggregator(this);
|
||||
m_dataEngineAggregator = new AWDataEngineAggregator(this);
|
||||
m_keyOperator = new AWKeyOperations(this);
|
||||
|
||||
m_timer = new QTimer(this);
|
||||
m_timer->setSingleShot(false);
|
||||
|
||||
// update key data if required
|
||||
connect(keyOperator, SIGNAL(updateKeys(QStringList)), this,
|
||||
connect(m_keyOperator, SIGNAL(updateKeys(QStringList)), this,
|
||||
SLOT(reinitKeys(QStringList)));
|
||||
connect(m_timer, SIGNAL(timeout()), this, SLOT(updateTextData()));
|
||||
// transfer signal from AWDataAggregator object to QML ui
|
||||
connect(dataAggregator, SIGNAL(toolTipPainted(const QString)), this,
|
||||
connect(m_dataAggregator, SIGNAL(toolTipPainted(const QString)), this,
|
||||
SIGNAL(needToolTipToBeUpdated(const QString)));
|
||||
connect(this, SIGNAL(dropSourceFromDataengine(QString)),
|
||||
dataEngineAggregator, SLOT(dropSource(QString)));
|
||||
m_dataEngineAggregator, SLOT(dropSource(QString)));
|
||||
// transfer signal from dataengine to update source list
|
||||
connect(dataEngineAggregator, SIGNAL(deviceAdded(const QString &)),
|
||||
keyOperator, SLOT(addDevice(const QString &)));
|
||||
connect(m_dataEngineAggregator, SIGNAL(deviceAdded(const QString &)),
|
||||
m_keyOperator, SLOT(addDevice(const QString &)));
|
||||
}
|
||||
|
||||
|
||||
@ -75,11 +75,11 @@ AWKeys::~AWKeys()
|
||||
delete m_timer;
|
||||
|
||||
// core
|
||||
delete dataEngineAggregator;
|
||||
delete m_dataEngineAggregator;
|
||||
delete m_threadPool;
|
||||
delete aggregator;
|
||||
delete dataAggregator;
|
||||
delete keyOperator;
|
||||
delete m_aggregator;
|
||||
delete m_dataAggregator;
|
||||
delete m_keyOperator;
|
||||
}
|
||||
|
||||
|
||||
@ -89,7 +89,7 @@ void AWKeys::initDataAggregator(const QVariantMap tooltipParams)
|
||||
|
||||
// store parameters to generate m_requiredKeys
|
||||
m_tooltipParams = tooltipParams;
|
||||
dataAggregator->setParameters(m_tooltipParams);
|
||||
m_dataAggregator->setParameters(m_tooltipParams);
|
||||
}
|
||||
|
||||
|
||||
@ -105,11 +105,11 @@ void AWKeys::initKeys(const QString currentPattern, const int interval,
|
||||
m_threadPool->setMaxThreadCount(limit == 0 ? QThread::idealThreadCount()
|
||||
: limit);
|
||||
// child objects
|
||||
aggregator->initFormatters();
|
||||
keyOperator->setPattern(currentPattern);
|
||||
keyOperator->updateCache();
|
||||
dataEngineAggregator->clear();
|
||||
dataEngineAggregator->initDataEngines(interval);
|
||||
m_aggregator->initFormatters();
|
||||
m_keyOperator->setPattern(currentPattern);
|
||||
m_keyOperator->updateCache();
|
||||
m_dataEngineAggregator->clear();
|
||||
m_dataEngineAggregator->initDataEngines(interval);
|
||||
|
||||
// timer
|
||||
m_timer->setInterval(interval);
|
||||
@ -121,7 +121,7 @@ void AWKeys::setAggregatorProperty(const QString key, const QVariant value)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Key" << key << "with value" << value;
|
||||
|
||||
aggregator->setProperty(key.toUtf8().constData(), value);
|
||||
m_aggregator->setProperty(key.toUtf8().constData(), value);
|
||||
}
|
||||
|
||||
|
||||
@ -135,7 +135,7 @@ void AWKeys::setWrapNewLines(const bool wrap)
|
||||
|
||||
void AWKeys::updateCache()
|
||||
{
|
||||
return keyOperator->updateCache();
|
||||
return m_keyOperator->updateCache();
|
||||
}
|
||||
|
||||
|
||||
@ -144,7 +144,7 @@ QStringList AWKeys::dictKeys(const bool sorted, const QString regexp) const
|
||||
qCDebug(LOG_AW) << "Should be sorted" << sorted << "and filter applied"
|
||||
<< regexp;
|
||||
|
||||
QStringList allKeys = keyOperator->dictKeys();
|
||||
QStringList allKeys = m_keyOperator->dictKeys();
|
||||
// sort if required
|
||||
if (sorted)
|
||||
allKeys.sort();
|
||||
@ -155,7 +155,7 @@ QStringList AWKeys::dictKeys(const bool sorted, const QString regexp) const
|
||||
|
||||
QStringList AWKeys::getHddDevices() const
|
||||
{
|
||||
QStringList devices = keyOperator->devices(QString("hdd"));
|
||||
QStringList devices = m_keyOperator->devices(QString("hdd"));
|
||||
// required by selector in the UI
|
||||
devices.insert(0, QString("disable"));
|
||||
devices.insert(0, QString("auto"));
|
||||
@ -168,7 +168,7 @@ QString AWKeys::infoByKey(QString key) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Requested info for key" << key;
|
||||
|
||||
return keyOperator->infoByKey(key);
|
||||
return m_keyOperator->infoByKey(key);
|
||||
}
|
||||
|
||||
|
||||
@ -178,9 +178,9 @@ QString AWKeys::valueByKey(QString key) const
|
||||
qCDebug(LOG_AW) << "Requested value for key" << key;
|
||||
|
||||
QString trueKey
|
||||
= key.startsWith(QString("bar")) ? keyOperator->infoByKey(key) : key;
|
||||
= key.startsWith(QString("bar")) ? m_keyOperator->infoByKey(key) : key;
|
||||
|
||||
return aggregator->formatter(values[trueKey], trueKey);
|
||||
return m_aggregator->formatter(m_values[trueKey], trueKey);
|
||||
}
|
||||
|
||||
|
||||
@ -188,7 +188,7 @@ void AWKeys::editItem(const QString type)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Item type" << type;
|
||||
|
||||
return keyOperator->editItem(type);
|
||||
return m_keyOperator->editItem(type);
|
||||
}
|
||||
|
||||
|
||||
@ -206,15 +206,15 @@ void AWKeys::reinitKeys(const QStringList currentKeys)
|
||||
qCDebug(LOG_AW) << "Update found keys by using list" << currentKeys;
|
||||
|
||||
// append lists
|
||||
m_foundBars = AWPatternFunctions::findKeys(keyOperator->pattern(),
|
||||
m_foundBars = AWPatternFunctions::findKeys(m_keyOperator->pattern(),
|
||||
currentKeys, true);
|
||||
m_foundKeys = AWPatternFunctions::findKeys(keyOperator->pattern(),
|
||||
m_foundKeys = AWPatternFunctions::findKeys(m_keyOperator->pattern(),
|
||||
currentKeys, false);
|
||||
m_foundLambdas = AWPatternFunctions::findLambdas(keyOperator->pattern());
|
||||
m_foundLambdas = AWPatternFunctions::findLambdas(m_keyOperator->pattern());
|
||||
// generate list of required keys for bars
|
||||
QStringList barKeys;
|
||||
for (auto bar : m_foundBars) {
|
||||
GraphicalItem *item = keyOperator->giByKey(bar);
|
||||
GraphicalItem *item = m_keyOperator->giByKey(bar);
|
||||
if (item->isCustom())
|
||||
item->setUsedKeys(
|
||||
AWPatternFunctions::findKeys(item->bar(), currentKeys, false));
|
||||
@ -228,8 +228,8 @@ void AWKeys::reinitKeys(const QStringList currentKeys)
|
||||
m_tooltipParams, currentKeys)
|
||||
: QStringList();
|
||||
|
||||
// set key data to aggregator
|
||||
aggregator->setDevices(keyOperator->devices());
|
||||
// set key data to m_aggregator
|
||||
m_aggregator->setDevices(m_keyOperator->devices());
|
||||
}
|
||||
|
||||
|
||||
@ -238,11 +238,11 @@ void AWKeys::updateTextData()
|
||||
// do not do it in parallel to avoid race condition
|
||||
m_mutex.lock();
|
||||
calculateValues();
|
||||
QString text = parsePattern(keyOperator->pattern());
|
||||
QString text = parsePattern(m_keyOperator->pattern());
|
||||
m_mutex.unlock();
|
||||
|
||||
emit(needTextToBeUpdated(text));
|
||||
emit(dataAggregator->updateData(values));
|
||||
emit(m_dataAggregator->updateData(m_values));
|
||||
}
|
||||
|
||||
|
||||
@ -251,54 +251,58 @@ void AWKeys::updateTextData()
|
||||
void AWKeys::calculateValues()
|
||||
{
|
||||
// hddtot*
|
||||
QStringList mountDevices = keyOperator->devices(QString("mount"));
|
||||
QStringList mountDevices = m_keyOperator->devices(QString("mount"));
|
||||
for (auto device : mountDevices) {
|
||||
int index = mountDevices.indexOf(device);
|
||||
values[QString("hddtotmb%1").arg(index)]
|
||||
= values[QString("hddfreemb%1").arg(index)].toFloat()
|
||||
+ values[QString("hddmb%1").arg(index)].toFloat();
|
||||
values[QString("hddtotgb%1").arg(index)]
|
||||
= values[QString("hddfreegb%1").arg(index)].toFloat()
|
||||
+ values[QString("hddgb%1").arg(index)].toFloat();
|
||||
m_values[QString("hddtotmb%1").arg(index)]
|
||||
= m_values[QString("hddfreemb%1").arg(index)].toFloat()
|
||||
+ m_values[QString("hddmb%1").arg(index)].toFloat();
|
||||
m_values[QString("hddtotgb%1").arg(index)]
|
||||
= m_values[QString("hddfreegb%1").arg(index)].toFloat()
|
||||
+ m_values[QString("hddgb%1").arg(index)].toFloat();
|
||||
}
|
||||
|
||||
// memtot*
|
||||
values[QString("memtotmb")] = values[QString("memusedmb")].toInt()
|
||||
+ values[QString("memfreemb")].toInt();
|
||||
values[QString("memtotgb")] = values[QString("memusedgb")].toFloat()
|
||||
+ values[QString("memfreegb")].toFloat();
|
||||
m_values[QString("memtotmb")] = m_values[QString("memusedmb")].toInt()
|
||||
+ m_values[QString("memfreemb")].toInt();
|
||||
m_values[QString("memtotgb")] = m_values[QString("memusedgb")].toFloat()
|
||||
+ m_values[QString("memfreegb")].toFloat();
|
||||
// mem
|
||||
values[QString("mem")] = 100.0f * values[QString("memmb")].toFloat()
|
||||
/ values[QString("memtotmb")].toFloat();
|
||||
m_values[QString("mem")] = 100.0f * m_values[QString("memmb")].toFloat()
|
||||
/ m_values[QString("memtotmb")].toFloat();
|
||||
|
||||
// up, down, upkb, downkb, upunits, downunits
|
||||
int netIndex = keyOperator->devices(QString("net"))
|
||||
.indexOf(values[QString("netdev")].toString());
|
||||
values[QString("down")] = values[QString("down%1").arg(netIndex)];
|
||||
values[QString("downkb")] = values[QString("downkb%1").arg(netIndex)];
|
||||
values[QString("downtotal")] = values[QString("downtotal%1").arg(netIndex)];
|
||||
values[QString("downtotalkb")]
|
||||
= values[QString("downtotalkb%1").arg(netIndex)];
|
||||
values[QString("downunits")] = values[QString("downunits%1").arg(netIndex)];
|
||||
values[QString("up")] = values[QString("up%1").arg(netIndex)];
|
||||
values[QString("upkb")] = values[QString("upkb%1").arg(netIndex)];
|
||||
values[QString("uptotal")] = values[QString("uptotal%1").arg(netIndex)];
|
||||
values[QString("uptotalkb")] = values[QString("uptotalkb%1").arg(netIndex)];
|
||||
values[QString("upunits")] = values[QString("upunits%1").arg(netIndex)];
|
||||
int netIndex = m_keyOperator->devices(QString("net"))
|
||||
.indexOf(m_values[QString("netdev")].toString());
|
||||
m_values[QString("down")] = m_values[QString("down%1").arg(netIndex)];
|
||||
m_values[QString("downkb")] = m_values[QString("downkb%1").arg(netIndex)];
|
||||
m_values[QString("downtotal")]
|
||||
= m_values[QString("downtotal%1").arg(netIndex)];
|
||||
m_values[QString("downtotalkb")]
|
||||
= m_values[QString("downtotalkb%1").arg(netIndex)];
|
||||
m_values[QString("downunits")]
|
||||
= m_values[QString("downunits%1").arg(netIndex)];
|
||||
m_values[QString("up")] = m_values[QString("up%1").arg(netIndex)];
|
||||
m_values[QString("upkb")] = m_values[QString("upkb%1").arg(netIndex)];
|
||||
m_values[QString("uptotal")] = m_values[QString("uptotal%1").arg(netIndex)];
|
||||
m_values[QString("uptotalkb")]
|
||||
= m_values[QString("uptotalkb%1").arg(netIndex)];
|
||||
m_values[QString("upunits")] = m_values[QString("upunits%1").arg(netIndex)];
|
||||
|
||||
// swaptot*
|
||||
values[QString("swaptotmb")] = values[QString("swapmb")].toInt()
|
||||
+ values[QString("swapfreemb")].toInt();
|
||||
values[QString("swaptotgb")] = values[QString("swapgb")].toFloat()
|
||||
+ values[QString("swapfreegb")].toFloat();
|
||||
m_values[QString("swaptotmb")] = m_values[QString("swapmb")].toInt()
|
||||
+ m_values[QString("swapfreemb")].toInt();
|
||||
m_values[QString("swaptotgb")]
|
||||
= m_values[QString("swapgb")].toFloat()
|
||||
+ m_values[QString("swapfreegb")].toFloat();
|
||||
// swap
|
||||
values[QString("swap")] = 100.0f * values[QString("swapmb")].toFloat()
|
||||
/ values[QString("swaptotmb")].toFloat();
|
||||
m_values[QString("swap")] = 100.0f * m_values[QString("swapmb")].toFloat()
|
||||
/ m_values[QString("swaptotmb")].toFloat();
|
||||
|
||||
// lambdas
|
||||
for (auto key : m_foundLambdas)
|
||||
values[key] = AWPatternFunctions::expandLambdas(key, aggregator, values,
|
||||
m_foundKeys);
|
||||
m_values[key] = AWPatternFunctions::expandLambdas(
|
||||
key, m_aggregator, m_values, m_foundKeys);
|
||||
}
|
||||
|
||||
|
||||
@ -309,27 +313,27 @@ QString AWKeys::parsePattern(QString pattern) const
|
||||
|
||||
// lambdas
|
||||
for (auto key : m_foundLambdas)
|
||||
pattern.replace(QString("${{%1}}").arg(key), values[key].toString());
|
||||
pattern.replace(QString("${{%1}}").arg(key), m_values[key].toString());
|
||||
|
||||
// main keys
|
||||
for (auto key : m_foundKeys)
|
||||
pattern.replace(QString("$%1").arg(key), [this](const QString &tag,
|
||||
const QVariant &value) {
|
||||
QString strValue = aggregator->formatter(value, tag);
|
||||
QString strValue = m_aggregator->formatter(value, tag);
|
||||
if ((!tag.startsWith(QString("custom")))
|
||||
&& (!tag.startsWith(QString("weather"))))
|
||||
strValue.replace(QString(" "), QString(" "));
|
||||
return strValue;
|
||||
}(key, values[key]));
|
||||
}(key, m_values[key]));
|
||||
|
||||
// bars
|
||||
for (auto bar : m_foundBars) {
|
||||
GraphicalItem *item = keyOperator->giByKey(bar);
|
||||
GraphicalItem *item = m_keyOperator->giByKey(bar);
|
||||
QString image
|
||||
= item->isCustom()
|
||||
? item->image(AWPatternFunctions::expandLambdas(
|
||||
item->bar(), aggregator, values, item->usedKeys()))
|
||||
: item->image(values[item->bar()]);
|
||||
item->bar(), m_aggregator, m_values, item->usedKeys()))
|
||||
: item->image(m_values[item->bar()]);
|
||||
pattern.replace(QString("$%1").arg(bar), image);
|
||||
}
|
||||
|
||||
@ -347,9 +351,9 @@ void AWKeys::setDataBySource(const QString &sourceName, const QVariantMap &data)
|
||||
qCDebug(LOG_AW) << "Source" << sourceName << "with data" << data;
|
||||
|
||||
// first list init
|
||||
QStringList tags = aggregator->keysFromSource(sourceName);
|
||||
QStringList tags = m_aggregator->keysFromSource(sourceName);
|
||||
if (tags.isEmpty())
|
||||
tags = aggregator->registerSource(
|
||||
tags = m_aggregator->registerSource(
|
||||
sourceName, data[QString("units")].toString(), m_requiredKeys);
|
||||
|
||||
// update data or drop source if there are no matches and exit
|
||||
@ -362,9 +366,9 @@ void AWKeys::setDataBySource(const QString &sourceName, const QVariantMap &data)
|
||||
// HACK workaround for time values which are stored in the different path
|
||||
std::for_each(tags.cbegin(), tags.cend(),
|
||||
[this, &data, &sourceName](const QString &tag) {
|
||||
values[tag] = sourceName == QString("Local")
|
||||
? data[QString("DateTime")]
|
||||
: data[QString("value")];
|
||||
m_values[tag] = sourceName == QString("Local")
|
||||
? data[QString("DateTime")]
|
||||
: data[QString("value")];
|
||||
});
|
||||
m_mutex.unlock();
|
||||
}
|
||||
|
@ -79,15 +79,15 @@ private:
|
||||
QString parsePattern(QString pattern) const;
|
||||
void setDataBySource(const QString &sourceName, const QVariantMap &data);
|
||||
// objects
|
||||
AWDataAggregator *dataAggregator = nullptr;
|
||||
AWDataEngineAggregator *dataEngineAggregator = nullptr;
|
||||
AWKeysAggregator *aggregator = nullptr;
|
||||
AWKeyOperations *keyOperator = nullptr;
|
||||
AWDataAggregator *m_dataAggregator = nullptr;
|
||||
AWDataEngineAggregator *m_dataEngineAggregator = nullptr;
|
||||
AWKeysAggregator *m_aggregator = nullptr;
|
||||
AWKeyOperations *m_keyOperator = nullptr;
|
||||
QTimer *m_timer = nullptr;
|
||||
// variables
|
||||
QVariantMap m_tooltipParams;
|
||||
QStringList m_foundBars, m_foundKeys, m_foundLambdas, m_requiredKeys;
|
||||
QVariantHash values;
|
||||
QVariantHash m_values;
|
||||
bool m_optimize = false;
|
||||
bool m_wrapNewLines = false;
|
||||
// multithread features
|
||||
|
@ -132,7 +132,7 @@ QString AWKeysAggregator::formatter(const QVariant &data,
|
||||
case FormatterType::TimeCustom:
|
||||
output = m_customTime;
|
||||
[&output, loc, this](const QDateTime dt) {
|
||||
for (auto key : timeKeys)
|
||||
for (auto key : m_timeKeys)
|
||||
output.replace(QString("$%1").arg(key), loc.toString(dt, key));
|
||||
}(data.toDateTime());
|
||||
break;
|
||||
|
@ -89,7 +89,7 @@ public slots:
|
||||
private:
|
||||
float temperature(const float temp) const;
|
||||
AWFormatterHelper *m_customFormatters = nullptr;
|
||||
QStringList timeKeys = QString(TIME_KEYS).split(QChar(','));
|
||||
QStringList m_timeKeys = QString(TIME_KEYS).split(QChar(','));
|
||||
// variables
|
||||
QString m_acOffline;
|
||||
QString m_acOnline;
|
||||
|
Reference in New Issue
Block a user