Commit 844ad9e9c5b207900040bb8a7ab695ec40115145

Authored by Thiago Rocha
1 parent c3c9c886
Exists in master

Adicionado método coletaLinuxIsNotebook.

Showing 2 changed files with 18 additions and 0 deletions   Show diff stats
src/cacic_hardware.cpp
... ... @@ -287,6 +287,7 @@ QJsonObject cacic_hardware::coletaLinux()
287 287 if ( getuid() != 0 ) qDebug() << "Coleta de Bios e Motherboard requer root.";
288 288 coletaLinuxBios(hardware);
289 289 coletaLinuxMotherboard(hardware);
  290 + coletaLinuxIsNotebook(hardware);
290 291  
291 292 return hardware;
292 293 }
... ... @@ -414,6 +415,22 @@ void cacic_hardware::coletaLinuxMotherboard(QJsonObject &amp;hardware)
414 415 hardware["motherboard"] = motherboard;
415 416 }
416 417  
  418 +void cacic_hardware::coletaLinuxIsNotebook(QJsonObject &hardware)
  419 +{
  420 +
  421 + QStringList consoleOutput;
  422 +
  423 + consoleOutput= console("dmidecode -t 3").split("\n");
  424 +// qDebug() << consoleOutput;
  425 + foreach(QString line, consoleOutput){
  426 + if(line.contains("Type:")
  427 + && line.contains("Notebook") ){
  428 + hardware["is_notebook"] = QJsonValue::fromVariant(QString("true"));
  429 + }
  430 + }
  431 +
  432 +}
  433 +
417 434 #endif
418 435 QJsonObject cacic_hardware::toJsonObject() {
419 436 return coletaHardware;
... ...
src/cacic_hardware.h
... ... @@ -33,6 +33,7 @@ private:
33 33 void coletaLinuxPci(QJsonObject &hardware, const QJsonObject &pciJson);
34 34 void coletaLinuxBios(QJsonObject &hardware);
35 35 void coletaLinuxMotherboard(QJsonObject &hardware);
  36 + void coletaLinuxIsNotebook(QJsonObject &hardware);
36 37 #endif
37 38  
38 39 CCacic oCacic;
... ...