use m_ prefix for all internal variables, update CONTRIBUTING.md

accordingly
This commit is contained in:
2016-07-27 20:40:17 +03:00
parent 052d8a034c
commit 90c33ab24d
30 changed files with 403 additions and 387 deletions

View File

@ -28,7 +28,8 @@ CustomSource::CustomSource(QObject *parent, const QStringList args)
Q_ASSERT(args.count() == 0);
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
extScripts = new ExtItemAggregator<ExtScript>(nullptr, QString("scripts"));
m_extScripts
= new ExtItemAggregator<ExtScript>(nullptr, QString("scripts"));
m_sources = getSources();
}
@ -37,7 +38,7 @@ CustomSource::~CustomSource()
{
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
delete extScripts;
delete m_extScripts;
}
@ -46,7 +47,7 @@ QVariant CustomSource::data(QString source)
qCDebug(LOG_ESS) << "Source" << source;
// there are only one value
return extScripts->itemByTagNumber(index(source))->run().values().first();
return m_extScripts->itemByTagNumber(index(source))->run().values().first();
}
@ -59,7 +60,7 @@ QVariantMap CustomSource::initialData(QString source) const
data[QString("max")] = QString("");
data[QString("name")]
= QString("Custom command '%1' output")
.arg(extScripts->itemByTagNumber(index(source))->uniq());
.arg(m_extScripts->itemByTagNumber(index(source))->uniq());
data[QString("type")] = QString("QString");
data[QString("units")] = QString("");
@ -76,7 +77,7 @@ QStringList CustomSource::sources() const
QStringList CustomSource::getSources()
{
QStringList sources;
for (auto item : extScripts->activeItems())
for (auto item : m_extScripts->activeItems())
sources.append(QString("custom/%1").arg(item->tag(QString("custom"))));
return sources;

View File

@ -39,7 +39,7 @@ public:
private:
QStringList getSources();
// configuration and values
ExtItemAggregator<ExtScript> *extScripts = nullptr;
ExtItemAggregator<ExtScript> *m_extScripts = nullptr;
QStringList m_sources;
};

View File

@ -28,7 +28,7 @@ QuotesSource::QuotesSource(QObject *parent, const QStringList args)
Q_ASSERT(args.count() == 0);
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
extQuotes = new ExtItemAggregator<ExtQuotes>(nullptr, QString("quotes"));
m_extQuotes = new ExtItemAggregator<ExtQuotes>(nullptr, QString("quotes"));
m_sources = getSources();
}
@ -37,7 +37,7 @@ QuotesSource::~QuotesSource()
{
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
delete extQuotes;
delete m_extQuotes;
}
@ -48,7 +48,7 @@ QVariant QuotesSource::data(QString source)
int ind = index(source);
source.remove(QString("quotes/"));
if (!m_values.contains(source)) {
QVariantHash data = extQuotes->itemByTagNumber(ind)->run();
QVariantHash data = m_extQuotes->itemByTagNumber(ind)->run();
for (auto key : data.keys())
m_values[key] = data[key];
}
@ -68,7 +68,7 @@ QVariantMap QuotesSource::initialData(QString source) const
data[QString("max")] = 0.0;
data[QString("name")]
= QString("Absolute ask changes for '%1'")
.arg(extQuotes->itemByTagNumber(ind)->uniq());
.arg(m_extQuotes->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("double");
data[QString("units")] = QString("");
} else if (source.startsWith(QString("quotes/ask"))) {
@ -76,7 +76,7 @@ QVariantMap QuotesSource::initialData(QString source) const
data[QString("max")] = 0.0;
data[QString("name")]
= QString("Ask for '%1'")
.arg(extQuotes->itemByTagNumber(ind)->uniq());
.arg(m_extQuotes->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("double");
data[QString("units")] = QString("");
} else if (source.startsWith(QString("quotes/percaskchg"))) {
@ -84,7 +84,7 @@ QVariantMap QuotesSource::initialData(QString source) const
data[QString("max")] = 100.0;
data[QString("name")]
= QString("Ask changes for '%1'")
.arg(extQuotes->itemByTagNumber(ind)->uniq());
.arg(m_extQuotes->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("double");
data[QString("units")] = QString("");
} else if (source.startsWith(QString("quotes/bidchg"))) {
@ -92,7 +92,7 @@ QVariantMap QuotesSource::initialData(QString source) const
data[QString("max")] = 0.0;
data[QString("name")]
= QString("Absolute bid changes for '%1'")
.arg(extQuotes->itemByTagNumber(ind)->uniq());
.arg(m_extQuotes->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("double");
data[QString("units")] = QString("");
} else if (source.startsWith(QString("quotes/bid"))) {
@ -100,7 +100,7 @@ QVariantMap QuotesSource::initialData(QString source) const
data[QString("max")] = 0.0;
data[QString("name")]
= QString("Bid for '%1'")
.arg(extQuotes->itemByTagNumber(ind)->uniq());
.arg(m_extQuotes->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("double");
data[QString("units")] = QString("");
} else if (source.startsWith(QString("quotes/percbidchg"))) {
@ -108,7 +108,7 @@ QVariantMap QuotesSource::initialData(QString source) const
data[QString("max")] = 100.0;
data[QString("name")]
= QString("Bid changes for '%1'")
.arg(extQuotes->itemByTagNumber(ind)->uniq());
.arg(m_extQuotes->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("double");
data[QString("units")] = QString("");
} else if (source.startsWith(QString("quotes/pricechg"))) {
@ -116,7 +116,7 @@ QVariantMap QuotesSource::initialData(QString source) const
data[QString("max")] = 0.0;
data[QString("name")]
= QString("Absolute prie changes for '%1'")
.arg(extQuotes->itemByTagNumber(ind)->uniq());
.arg(m_extQuotes->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("double");
data[QString("units")] = QString("");
} else if (source.startsWith(QString("quotes/price"))) {
@ -124,7 +124,7 @@ QVariantMap QuotesSource::initialData(QString source) const
data[QString("max")] = 0.0;
data[QString("name")]
= QString("Price for '%1'")
.arg(extQuotes->itemByTagNumber(ind)->uniq());
.arg(m_extQuotes->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("double");
data[QString("units")] = QString("");
} else if (source.startsWith(QString("quotes/percpricechg"))) {
@ -132,7 +132,7 @@ QVariantMap QuotesSource::initialData(QString source) const
data[QString("max")] = 100.0;
data[QString("name")]
= QString("Price changes for '%1'")
.arg(extQuotes->itemByTagNumber(ind)->uniq());
.arg(m_extQuotes->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("double");
data[QString("units")] = QString("");
}
@ -150,7 +150,7 @@ QStringList QuotesSource::sources() const
QStringList QuotesSource::getSources()
{
QStringList sources;
for (auto item : extQuotes->activeItems()) {
for (auto item : m_extQuotes->activeItems()) {
sources.append(QString("quotes/%1").arg(item->tag(QString("ask"))));
sources.append(QString("quotes/%1").arg(item->tag(QString("askchg"))));
sources.append(

View File

@ -39,7 +39,7 @@ public:
private:
QStringList getSources();
// configuration and values
ExtItemAggregator<ExtQuotes> *extQuotes = nullptr;
ExtItemAggregator<ExtQuotes> *m_extQuotes = nullptr;
QStringList m_sources;
QVariantHash m_values;
};

View File

@ -28,7 +28,8 @@ UpgradeSource::UpgradeSource(QObject *parent, const QStringList args)
Q_ASSERT(args.count() == 0);
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
extUpgrade = new ExtItemAggregator<ExtUpgrade>(nullptr, QString("upgrade"));
m_extUpgrade
= new ExtItemAggregator<ExtUpgrade>(nullptr, QString("upgrade"));
m_sources = getSources();
}
@ -37,7 +38,7 @@ UpgradeSource::~UpgradeSource()
{
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
delete extUpgrade;
delete m_extUpgrade;
}
@ -46,7 +47,7 @@ QVariant UpgradeSource::data(QString source)
qCDebug(LOG_ESS) << "Source" << source;
// there are only one value
return extUpgrade->itemByTagNumber(index(source))->run().values().first();
return m_extUpgrade->itemByTagNumber(index(source))->run().values().first();
}
@ -59,7 +60,7 @@ QVariantMap UpgradeSource::initialData(QString source) const
data[QString("max")] = QString("");
data[QString("name")]
= QString("Package manager '%1' metadata")
.arg(extUpgrade->itemByTagNumber(index(source))->uniq());
.arg(m_extUpgrade->itemByTagNumber(index(source))->uniq());
data[QString("type")] = QString("QString");
data[QString("units")] = QString("");
@ -76,7 +77,7 @@ QStringList UpgradeSource::sources() const
QStringList UpgradeSource::getSources()
{
QStringList sources;
for (auto item : extUpgrade->activeItems())
for (auto item : m_extUpgrade->activeItems())
sources.append(
QString("upgrade/%1").arg(item->tag(QString("pkgcount"))));

View File

@ -39,7 +39,7 @@ public:
private:
QStringList getSources();
// configuration and values
ExtItemAggregator<ExtUpgrade> *extUpgrade = nullptr;
ExtItemAggregator<ExtUpgrade> *m_extUpgrade = nullptr;
QStringList m_sources;
};

View File

@ -28,7 +28,8 @@ WeatherSource::WeatherSource(QObject *parent, const QStringList args)
Q_ASSERT(args.count() == 0);
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
extWeather = new ExtItemAggregator<ExtWeather>(nullptr, QString("weather"));
m_extWeather
= new ExtItemAggregator<ExtWeather>(nullptr, QString("weather"));
m_sources = getSources();
}
@ -37,7 +38,7 @@ WeatherSource::~WeatherSource()
{
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
delete extWeather;
delete m_extWeather;
}
@ -48,7 +49,7 @@ QVariant WeatherSource::data(QString source)
int ind = index(source);
source.remove(QString("weather/"));
if (!m_values.contains(source)) {
QVariantHash data = extWeather->itemByTagNumber(ind)->run();
QVariantHash data = m_extWeather->itemByTagNumber(ind)->run();
for (auto key : data.keys())
m_values[key] = data[key];
}
@ -68,7 +69,7 @@ QVariantMap WeatherSource::initialData(QString source) const
data[QString("max")] = 1000;
data[QString("name")]
= QString("Numeric weather ID for '%1'")
.arg(extWeather->itemByTagNumber(ind)->uniq());
.arg(m_extWeather->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("integer");
data[QString("units")] = QString("");
} else if (source.startsWith(QString("weather/weather"))) {
@ -76,7 +77,7 @@ QVariantMap WeatherSource::initialData(QString source) const
data[QString("max")] = QString("");
data[QString("name")]
= QString("ID string map for '%1'")
.arg(extWeather->itemByTagNumber(ind)->uniq());
.arg(m_extWeather->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("QString");
data[QString("units")] = QString("");
} else if (source.startsWith(QString("weather/humidity"))) {
@ -84,7 +85,7 @@ QVariantMap WeatherSource::initialData(QString source) const
data[QString("max")] = 100;
data[QString("name")]
= QString("Humidity for '%1'")
.arg(extWeather->itemByTagNumber(ind)->uniq());
.arg(m_extWeather->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("integer");
data[QString("units")] = QString("%");
} else if (source.startsWith(QString("weather/pressure"))) {
@ -92,7 +93,7 @@ QVariantMap WeatherSource::initialData(QString source) const
data[QString("max")] = 0;
data[QString("name")]
= QString("Atmospheric pressure for '%1'")
.arg(extWeather->itemByTagNumber(ind)->uniq());
.arg(m_extWeather->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("integer");
data[QString("units")] = QString("mb");
} else if (source.startsWith(QString("weather/temperature"))) {
@ -100,7 +101,7 @@ QVariantMap WeatherSource::initialData(QString source) const
data[QString("max")] = 0.0;
data[QString("name")]
= QString("Temperature for '%1'")
.arg(extWeather->itemByTagNumber(ind)->uniq());
.arg(m_extWeather->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("float");
data[QString("units")] = QString("°C");
} else if (source.startsWith(QString("weather/timestamp"))) {
@ -108,7 +109,7 @@ QVariantMap WeatherSource::initialData(QString source) const
data[QString("max")] = QString("");
data[QString("name")]
= QString("Timestamp for '%1'")
.arg(extWeather->itemByTagNumber(ind)->uniq());
.arg(m_extWeather->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("QString");
data[QString("units")] = QString("");
}
@ -126,7 +127,7 @@ QStringList WeatherSource::sources() const
QStringList WeatherSource::getSources()
{
QStringList sources;
for (auto item : extWeather->activeItems()) {
for (auto item : m_extWeather->activeItems()) {
sources.append(
QString("weather/%1").arg(item->tag(QString("weatherId"))));
sources.append(

View File

@ -39,7 +39,7 @@ public:
private:
QStringList getSources();
// configuration and values
ExtItemAggregator<ExtWeather> *extWeather = nullptr;
ExtItemAggregator<ExtWeather> *m_extWeather = nullptr;
QStringList m_sources;
QVariantHash m_values;
};