Commit c3ed5b34f7baef53bf4f6234fb99d52694433f93

Authored by Thiago Rocha
1 parent c5a6cbac
Exists in master

Correções para rodar no linux e na coleta de hardware linux.

src/cacic_hardware.cpp
... ... @@ -11,7 +11,7 @@ void cacic_hardware::iniciaColeta()
11 11 OperatingSystem operatingSystem;
12 12  
13 13 // se o shell retorna erro ao tentar utilizar o lshw ou o dmidecode, instala o mesmo
14   - if( console("lshw").contains("/bin/sh") ){ qDebug() << "lshw nao instalado.";
  14 + if( console("lshw").contains("/bin/sh:") ){ qDebug() << "lshw nao instalado.";
15 15 if(operatingSystem.getIdOs() == OperatingSystem::LINUX_ARCH)
16 16 console("pacman -S --needed --noconfirm lshw");
17 17 else if(operatingSystem.getIdOs() == OperatingSystem::LINUX_DEBIAN ||
... ... @@ -400,15 +400,17 @@ void cacic_hardware::coletaLinuxMotherboard(QJsonObject &amp;hardware)
400 400 }
401 401  
402 402 consoleOutput= console("dmidecode -t 10").split("\n");
  403 +
  404 + QVariantList onboardCapabilities;
403 405 foreach(QString line, consoleOutput){
404   - QJsonArray onboardCapabilities;
405 406  
406 407 if(line.contains("Type:") )
407 408 onboardCapabilities.append( QJsonValue::fromVariant( QString(line.split(":")[1].mid(1)) ) );
408 409  
409   - motherboard["onboard_capabilities"] = onboardCapabilities;
410 410 }
411 411  
  412 + motherboard["onboard_capabilities"] = QJsonValue::fromVariant(onboardCapabilities);
  413 +
412 414 hardware["motherboard"] = motherboard;
413 415 }
414 416  
... ...
src/wmi.cpp
1 1 #include "wmi.h"
  2 +#ifdef Q_OS_WIN
2 3  
3 4 wmi::wmi()
4 5 {
... ... @@ -94,3 +95,4 @@ QJsonValue wmi::wmiSearch(QString classe, QStringList params)
94 95  
95 96 return wmiReturn;
96 97 }
  98 +#endif //def Q_OS_WIN
... ...
src/wmi.h
... ... @@ -2,8 +2,10 @@
2 2 #define WMI_H
3 3  
4 4 #include <ccacic.h>
  5 +#ifdef Q_OS_WIN
5 6 #include <windows.h>
6 7 #include <ActiveQt/ActiveQt>
  8 +#endif
7 9  
8 10 class wmi
9 11 {
... ...