Commit d6cc22d1ee878aca5acfa163e88ff870ddb00b9c

Authored by Thiago Rocha
1 parent 0946450f
Exists in master

Conserto de comparações dos valores armazenados em Json.

Showing 1 changed file with 7 additions and 7 deletions   Show diff stats
src/cacic_hardware.cpp
@@ -38,7 +38,7 @@ QJsonObject cacic_hardware::coletaLinux() @@ -38,7 +38,7 @@ QJsonObject cacic_hardware::coletaLinux()
38 38
39 QJsonObject lshwJson = oCacic.getJsonFromFile("lshwJson.json")["children"].toArray().first().toObject(); 39 QJsonObject lshwJson = oCacic.getJsonFromFile("lshwJson.json")["children"].toArray().first().toObject();
40 40
41 - if( lshwJson.contains("id") && lshwJson["id"] == "core") { 41 + if( lshwJson.contains("id") && lshwJson["id"] == QJsonValue::fromVariant(QString("core")) ) {
42 if ( lshwJson["children"].isArray() ){ 42 if ( lshwJson["children"].isArray() ){
43 // qDebug() << "IS ARRAY!!"; 43 // qDebug() << "IS ARRAY!!";
44 QJsonArray componentsArray = lshwJson["children"].toArray(); 44 QJsonArray componentsArray = lshwJson["children"].toArray();
@@ -55,11 +55,11 @@ QJsonObject cacic_hardware::coletaLinux() @@ -55,11 +55,11 @@ QJsonObject cacic_hardware::coletaLinux()
55 * coletaLinuxPci 55 * coletaLinuxPci
56 */ 56 */
57 57
58 - if( component["id"] == "memory" ) { 58 + if( component["id"] == QJsonValue::fromVariant(QString("memory")) ) {
59 coletaLinuxMem(hardware,component); 59 coletaLinuxMem(hardware,component);
60 - } else if ( component["id"] == "cpu" ) { 60 + } else if ( component["id"] == QJsonValue::fromVariant(QString("cpu")) ) {
61 coletaLinuxCpu(hardware,component); 61 coletaLinuxCpu(hardware,component);
62 - } else if ( component["id"] == "pci" ) { 62 + } else if ( component["id"] == QJsonValue::fromVariant(QString("pci")) ) {
63 QJsonArray pciArray = component["children"].toArray(); 63 QJsonArray pciArray = component["children"].toArray();
64 64
65 foreach(QJsonValue pciValue, pciArray){ 65 foreach(QJsonValue pciValue, pciArray){
@@ -258,7 +258,7 @@ void cacic_hardware::coletaLinuxPci(QJsonObject &amp;hardware, const QJsonObject &amp;pc @@ -258,7 +258,7 @@ void cacic_hardware::coletaLinuxPci(QJsonObject &amp;hardware, const QJsonObject &amp;pc
258 258
259 QJsonObject pciMember; 259 QJsonObject pciMember;
260 260
261 - if ( pciJson["id"] == "multimedia") { 261 + if ( pciJson["id"] == QJsonValue::fromVariant(QString("multimedia")) ) {
262 pciMember["description"] = pciJson["description"]; 262 pciMember["description"] = pciJson["description"];
263 pciMember["product"] = pciJson["product"]; 263 pciMember["product"] = pciJson["product"];
264 pciMember["vendor"] = pciJson["vendor"]; 264 pciMember["vendor"] = pciJson["vendor"];
@@ -270,7 +270,7 @@ void cacic_hardware::coletaLinuxPci(QJsonObject &amp;hardware, const QJsonObject &amp;pc @@ -270,7 +270,7 @@ void cacic_hardware::coletaLinuxPci(QJsonObject &amp;hardware, const QJsonObject &amp;pc
270 foreach( QJsonValue pciChild, pciChildren ) { 270 foreach( QJsonValue pciChild, pciChildren ) {
271 QJsonObject pciChildJson = pciChild.toObject(); 271 QJsonObject pciChildJson = pciChild.toObject();
272 272
273 - if( pciChildJson["id"] == "network" && 273 + if( pciChildJson["id"] == QJsonValue::fromVariant(QString("network")) &&
274 ( pciChildJson["description"].toString().contains("Wireless") || 274 ( pciChildJson["description"].toString().contains("Wireless") ||
275 pciChildJson["product"].toString().contains("Wireless") )) { 275 pciChildJson["product"].toString().contains("Wireless") )) {
276 pciMember["description"] = pciChildJson["description"]; 276 pciMember["description"] = pciChildJson["description"];
@@ -281,7 +281,7 @@ void cacic_hardware::coletaLinuxPci(QJsonObject &amp;hardware, const QJsonObject &amp;pc @@ -281,7 +281,7 @@ void cacic_hardware::coletaLinuxPci(QJsonObject &amp;hardware, const QJsonObject &amp;pc
281 pciMember["firmware"] = pciChildJson["configuration"].toObject()["firmware"]; 281 pciMember["firmware"] = pciChildJson["configuration"].toObject()["firmware"];
282 282
283 hardware["wireless_card"] = pciMember; 283 hardware["wireless_card"] = pciMember;
284 - } else if( pciChildJson["id"] == "network" ) { 284 + } else if( pciChildJson["id"] == QJsonValue::fromVariant(QString("network")) ) {
285 pciMember["description"] = pciChildJson["description"]; 285 pciMember["description"] = pciChildJson["description"];
286 pciMember["product"] = pciChildJson["product"]; 286 pciMember["product"] = pciChildJson["product"];
287 pciMember["vendor"] = pciChildJson["vendor"]; 287 pciMember["vendor"] = pciChildJson["vendor"];