mirror of
				https://github.com/arcan1s/awesome-widgets.git
				synced 2025-10-31 13:13:41 +00:00 
			
		
		
		
	add setKeys() function
This commit is contained in:
		| @ -43,6 +43,8 @@ ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args) | ||||
|  | ||||
|     setMinimumPollingInterval(333); | ||||
|     readConfiguration(); | ||||
|     setProcesses(); | ||||
|     setKeys(); | ||||
| } | ||||
|  | ||||
|  | ||||
| @ -142,7 +144,6 @@ void ExtendedSysMon::readConfiguration() | ||||
|     } | ||||
|     confFile.close(); | ||||
|     configuration = updateConfiguration(rawConfig); | ||||
|     setProcesses(); | ||||
| } | ||||
|  | ||||
|  | ||||
| @ -189,6 +190,58 @@ void ExtendedSysMon::setProcesses() | ||||
| } | ||||
|  | ||||
|  | ||||
| void ExtendedSysMon::setKeys() | ||||
| { | ||||
|     QString key, source; | ||||
|     // custom | ||||
|     source = QString("custom"); | ||||
|     for (int i=0; i<configuration[QString("CUSTOM")].split(QString("@@"), QString::SkipEmptyParts).count(); i++) { | ||||
|         key = QString("custom") + QString::number(i); | ||||
|         setData(source, key, QString("")); | ||||
|     } | ||||
|     // gpu | ||||
|     source = QString("gpu"); | ||||
|     key = QString("GPU"); | ||||
|     setData(source, key, float(0.0)); | ||||
|     // gputemp | ||||
|     source = QString("gputemp"); | ||||
|     key = QString("GPUTemp"); | ||||
|     setData(source, key, float(0.0)); | ||||
|     // hddtemp | ||||
|     source = QString("hddtemp"); | ||||
|     for (int i=0; i<configuration[QString("HDDDEV")].split(QChar(','), QString::SkipEmptyParts).count(); i++) { | ||||
|         key = configuration[QString("HDDDEV")].split(QChar(','), QString::SkipEmptyParts)[i]; | ||||
|         setData(source, key, float(0.0)); | ||||
|     } | ||||
|     // pkg | ||||
|     source = QString("pkg"); | ||||
|     for (int i=0; i<configuration[QString("PKGCMD")].split(QString(","), QString::SkipEmptyParts).count(); i++) { | ||||
|         key = QString("pkgCount") + QString::number(i); | ||||
|         setData(source, key, 0); | ||||
|     } | ||||
|     // player | ||||
|     source = QString("player"); | ||||
|     key = QString("album"); | ||||
|     setData(source, key, QString("unknown")); | ||||
|     key = QString("artist"); | ||||
|     setData(source, key, QString("unknown")); | ||||
|     key = QString("duration"); | ||||
|     setData(source, key, QString("0")); | ||||
|     key = QString("progress"); | ||||
|     setData(source, key, QString("0")); | ||||
|     key = QString("title"); | ||||
|     setData(source, key, QString("unknown")); | ||||
|     // ps | ||||
|     source = QString("ps"); | ||||
|     key = QString("psCount"); | ||||
|     setData(source, key, QString("0")); | ||||
|     key = QString("ps"); | ||||
|     setData(source, key, QString("")); | ||||
|     key = QString("psTotal"); | ||||
|     setData(source, key, QString("0")); | ||||
| } | ||||
|  | ||||
|  | ||||
| QMap<QString, QString> ExtendedSysMon::updateConfiguration(const QMap<QString, QString> rawConfig) | ||||
| { | ||||
|     if (debug) qDebug() << "[DE]" << "[updateConfiguration]"; | ||||
|  | ||||
| @ -65,6 +65,7 @@ private: | ||||
|     QString getAllHdd(); | ||||
|     QString getAutoGpu(); | ||||
|     void readConfiguration(); | ||||
|     void setKeys(); | ||||
|     void setProcesses(); | ||||
|     QMap<QString, QString> updateConfiguration(const QMap<QString, QString> rawConfig); | ||||
| }; | ||||
|  | ||||
		Reference in New Issue
	
	Block a user