mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-08-30 12:19:56 +00:00
Replace yahoo finance to stooq (#131)
Old code is dropped to separated provider
This commit is contained in:
@ -86,26 +86,22 @@ bool ExtendedSysMon::updateSourceEvent(const QString &_source)
|
||||
|
||||
void ExtendedSysMon::readConfiguration()
|
||||
{
|
||||
QString fileName = QStandardPaths::locate(
|
||||
QStandardPaths::ConfigLocation, "plasma-dataengine-extsysmon.conf");
|
||||
QString fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation,
|
||||
"plasma-dataengine-extsysmon.conf");
|
||||
qCInfo(LOG_ESM) << "Configuration file" << fileName;
|
||||
QSettings settings(fileName, QSettings::IniFormat);
|
||||
QHash<QString, QString> rawConfig;
|
||||
|
||||
settings.beginGroup("Configuration");
|
||||
rawConfig["ACPIPATH"]
|
||||
= settings.value("ACPIPATH", "/sys/class/power_supply/").toString();
|
||||
rawConfig["ACPIPATH"] = settings.value("ACPIPATH", "/sys/class/power_supply/").toString();
|
||||
rawConfig["GPUDEV"] = settings.value("GPUDEV", "auto").toString();
|
||||
rawConfig["HDDDEV"] = settings.value("HDDDEV", "all").toString();
|
||||
rawConfig["HDDTEMPCMD"]
|
||||
= settings.value("HDDTEMPCMD", "sudo smartctl -a").toString();
|
||||
rawConfig["MPDADDRESS"]
|
||||
= settings.value("MPDADDRESS", "localhost").toString();
|
||||
rawConfig["HDDTEMPCMD"] = settings.value("HDDTEMPCMD", "sudo smartctl -a").toString();
|
||||
rawConfig["MPDADDRESS"] = settings.value("MPDADDRESS", "localhost").toString();
|
||||
rawConfig["MPDPORT"] = settings.value("MPDPORT", "6600").toString();
|
||||
rawConfig["MPRIS"] = settings.value("MPRIS", "auto").toString();
|
||||
rawConfig["PLAYER"] = settings.value("PLAYER", "mpris").toString();
|
||||
rawConfig["PLAYERSYMBOLS"]
|
||||
= settings.value("PLAYERSYMBOLS", "10").toString();
|
||||
rawConfig["PLAYERSYMBOLS"] = settings.value("PLAYERSYMBOLS", "10").toString();
|
||||
settings.endGroup();
|
||||
|
||||
m_configuration = updateConfiguration(rawConfig);
|
||||
@ -122,8 +118,7 @@ ExtendedSysMon::updateConfiguration(QHash<QString, QString> _rawConfig) const
|
||||
;
|
||||
else if (_rawConfig["GPUDEV"] == "auto")
|
||||
_rawConfig["GPUDEV"] = GPULoadSource::autoGpu();
|
||||
else if ((_rawConfig["GPUDEV"] != "ati")
|
||||
&& (_rawConfig["GPUDEV"] != "nvidia"))
|
||||
else if ((_rawConfig["GPUDEV"] != "ati") && (_rawConfig["GPUDEV"] != "nvidia"))
|
||||
_rawConfig["GPUDEV"] = GPULoadSource::autoGpu();
|
||||
// hdddev
|
||||
QStringList allHddDevices = HDDTemperatureSource::allHdd();
|
||||
@ -132,8 +127,7 @@ ExtendedSysMon::updateConfiguration(QHash<QString, QString> _rawConfig) const
|
||||
} else if (_rawConfig["HDDDEV"] == "disable") {
|
||||
_rawConfig["HDDDEV"] = "";
|
||||
} else {
|
||||
QStringList deviceList
|
||||
= _rawConfig["HDDDEV"].split(',', QString::SkipEmptyParts);
|
||||
QStringList deviceList = _rawConfig["HDDDEV"].split(',', QString::SkipEmptyParts);
|
||||
QStringList devices;
|
||||
QRegExp diskRegexp = QRegExp("^/dev/[hms]d[a-z]$");
|
||||
for (auto &device : deviceList)
|
||||
@ -158,7 +152,6 @@ ExtendedSysMon::updateConfiguration(QHash<QString, QString> _rawConfig) const
|
||||
}
|
||||
|
||||
|
||||
K_EXPORT_PLASMA_DATAENGINE_WITH_JSON(extsysmon, ExtendedSysMon,
|
||||
"plasma-dataengine-extsysmon.json")
|
||||
K_EXPORT_PLASMA_DATAENGINE_WITH_JSON(extsysmon, ExtendedSysMon, "plasma-dataengine-extsysmon.json")
|
||||
|
||||
#include "extsysmon.moc"
|
||||
|
@ -42,8 +42,7 @@ private:
|
||||
QHash<QString, QString> m_configuration;
|
||||
// methods
|
||||
void readConfiguration();
|
||||
QHash<QString, QString>
|
||||
updateConfiguration(QHash<QString, QString> _rawConfig) const;
|
||||
QHash<QString, QString> updateConfiguration(QHash<QString, QString> _rawConfig) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -34,8 +34,7 @@
|
||||
#include "weathersource.h"
|
||||
|
||||
|
||||
ExtSysMonAggregator::ExtSysMonAggregator(QObject *_parent,
|
||||
const QHash<QString, QString> &_config)
|
||||
ExtSysMonAggregator::ExtSysMonAggregator(QObject *_parent, const QHash<QString, QString> &_config)
|
||||
: QObject(_parent)
|
||||
{
|
||||
qCDebug(LOG_ESM) << __PRETTY_FUNCTION__;
|
||||
@ -72,8 +71,7 @@ QVariantMap ExtSysMonAggregator::initialData(const QString &_source) const
|
||||
{
|
||||
qCDebug(LOG_ESM) << "Source" << _source;
|
||||
|
||||
return hasSource(_source) ? m_map[_source]->initialData(_source)
|
||||
: QVariantMap();
|
||||
return hasSource(_source) ? m_map[_source]->initialData(_source) : QVariantMap();
|
||||
}
|
||||
|
||||
|
||||
@ -97,8 +95,7 @@ void ExtSysMonAggregator::init(const QHash<QString, QString> &_config)
|
||||
for (auto &source : customItem->sources())
|
||||
m_map[source] = customItem;
|
||||
// desktop
|
||||
AbstractExtSysMonSource *desktopItem
|
||||
= new DesktopSource(this, QStringList());
|
||||
AbstractExtSysMonSource *desktopItem = new DesktopSource(this, QStringList());
|
||||
for (auto &source : desktopItem->sources())
|
||||
m_map[source] = desktopItem;
|
||||
// gpu load
|
||||
@ -112,30 +109,26 @@ void ExtSysMonAggregator::init(const QHash<QString, QString> &_config)
|
||||
for (auto &source : gpuTempItem->sources())
|
||||
m_map[source] = gpuTempItem;
|
||||
// hdd temperature
|
||||
AbstractExtSysMonSource *hddTempItem = new HDDTemperatureSource(
|
||||
this, QStringList({_config["HDDDEV"], _config["HDDTEMPCMD"]}));
|
||||
AbstractExtSysMonSource *hddTempItem
|
||||
= new HDDTemperatureSource(this, QStringList({_config["HDDDEV"], _config["HDDTEMPCMD"]}));
|
||||
for (auto &source : hddTempItem->sources())
|
||||
m_map[source] = hddTempItem;
|
||||
// network
|
||||
AbstractExtSysMonSource *networkItem
|
||||
= new NetworkSource(this, QStringList());
|
||||
AbstractExtSysMonSource *networkItem = new NetworkSource(this, QStringList());
|
||||
for (auto &source : networkItem->sources())
|
||||
m_map[source] = networkItem;
|
||||
// player
|
||||
AbstractExtSysMonSource *playerItem = new PlayerSource(
|
||||
this, QStringList({_config["PLAYER"], _config["MPDADDRESS"],
|
||||
_config["MPDPORT"], _config["MPRIS"],
|
||||
_config["PLAYERSYMBOLS"]}));
|
||||
this, QStringList({_config["PLAYER"], _config["MPDADDRESS"], _config["MPDPORT"],
|
||||
_config["MPRIS"], _config["PLAYERSYMBOLS"]}));
|
||||
for (auto &source : playerItem->sources())
|
||||
m_map[source] = playerItem;
|
||||
// processes
|
||||
AbstractExtSysMonSource *processesItem
|
||||
= new ProcessesSource(this, QStringList());
|
||||
AbstractExtSysMonSource *processesItem = new ProcessesSource(this, QStringList());
|
||||
for (auto &source : processesItem->sources())
|
||||
m_map[source] = processesItem;
|
||||
// network request
|
||||
AbstractExtSysMonSource *requestItem
|
||||
= new RequestSource(this, QStringList());
|
||||
AbstractExtSysMonSource *requestItem = new RequestSource(this, QStringList());
|
||||
for (auto &source : requestItem->sources())
|
||||
m_map[source] = requestItem;
|
||||
// quotes
|
||||
@ -143,13 +136,11 @@ void ExtSysMonAggregator::init(const QHash<QString, QString> &_config)
|
||||
for (auto &source : quotesItem->sources())
|
||||
m_map[source] = quotesItem;
|
||||
// upgrade
|
||||
AbstractExtSysMonSource *upgradeItem
|
||||
= new UpgradeSource(this, QStringList());
|
||||
AbstractExtSysMonSource *upgradeItem = new UpgradeSource(this, QStringList());
|
||||
for (auto &source : upgradeItem->sources())
|
||||
m_map[source] = upgradeItem;
|
||||
// weather
|
||||
AbstractExtSysMonSource *weatherItem
|
||||
= new WeatherSource(this, QStringList());
|
||||
AbstractExtSysMonSource *weatherItem = new WeatherSource(this, QStringList());
|
||||
for (auto &source : weatherItem->sources())
|
||||
m_map[source] = weatherItem;
|
||||
#ifdef BUILD_LOAD
|
||||
|
@ -28,8 +28,7 @@ class ExtSysMonAggregator : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ExtSysMonAggregator(QObject *_parent,
|
||||
const QHash<QString, QString> &_config);
|
||||
explicit ExtSysMonAggregator(QObject *_parent, const QHash<QString, QString> &_config);
|
||||
virtual ~ExtSysMonAggregator();
|
||||
QVariant data(const QString &_source) const;
|
||||
bool hasSource(const QString &_source) const;
|
||||
|
Reference in New Issue
Block a user