Commit d4ccf4a1f0dcc67ff26e5361251be7351ab46f72

Authored by Thiago Rocha
1 parent f78ed3f8
Exists in master

Consertos para rodar no Linux/Ubuntu.

gercols/gercols.cpp
... ... @@ -12,12 +12,12 @@ Gercols::Gercols(QObject *parent)
12 12 ******************************************/
13 13 QJsonObject configTeste;
14 14 QJsonObject configComputer;
15   - configComputer["operating_system"] = "";
16   - configComputer["user"] = "";
17   - configComputer["network_interface"] = "";
  15 + configComputer["operating_system"] = QJsonValue::fromVariant(QString(""));
  16 + configComputer["user"] = QJsonValue::fromVariant(QString(""));
  17 + configComputer["network_interface"] = QJsonValue::fromVariant(QString(""));
18 18 configTeste["computer"] = configComputer;
19   - configTeste["hardware"] = "";
20   - configTeste["software"] = "";
  19 + configTeste["hardware"] = QJsonValue::fromVariant(QString(""));
  20 + configTeste["software"] = QJsonValue::fromVariant(QString(""));
21 21  
22 22 oCacic.setJsonToFile(configTeste,"configReq.json");
23 23 /******************************************/
... ...
src/cacic_software.cpp
... ... @@ -16,6 +16,7 @@ void cacic_software::iniciaColeta()
16 16 #endif
17 17 }
18 18  
  19 +#if defined(Q_OS_WIN)
19 20 QJsonObject cacic_software::coletaWin()
20 21 {
21 22 QJsonObject softwaresJson;
... ... @@ -54,6 +55,7 @@ QJsonObject cacic_software::coletaWin()
54 55 return softwaresJson;
55 56 }
56 57  
  58 +#elif defined(Q_OS_LINUX)
57 59 QJsonObject cacic_software::coletaLinux()
58 60 {
59 61  
... ... @@ -115,10 +117,10 @@ QJsonObject cacic_software::coletaDebian()
115 117 ConsoleObject console;
116 118 QJsonObject softwaresJson;
117 119  
118   - QStringList packages = console("dpkg --get-selections").split("\n");
  120 + QStringList packages = console("dpkg --get-selections | grep -v '\^lib\\|\^fonts'").split("\n");
119 121  
120 122 foreach(QString package, packages) {
121   - QString packageName = package.split(" ")[0];
  123 + QString packageName = package.split("\t")[0];
122 124 QJsonObject packageJson;
123 125  
124 126 QStringList packageInfo = console(QString("apt-cache show ").append(packageName)).split("\n");
... ... @@ -126,11 +128,11 @@ QJsonObject cacic_software::coletaDebian()
126 128  
127 129 packageJson["name"] = QJsonValue::fromVariant(QString(packageName));
128 130 foreach(QString line, packageInfo) {
129   - if(line.contains("Version"))
  131 + if(line.contains("Version:"))
130 132 packageJson["version"] = line.split(":")[1].mid(1);
131   - if(line.contains("Description"))
  133 + if(line.contains("Description-en:"))
132 134 packageJson["description"] = line.split(":")[1].mid(1);
133   - if(line.contains("Homepage")) {
  135 + if(line.contains("Homepage:")) {
134 136 QStringList url = line.split(":");
135 137 QString urlString;
136 138  
... ... @@ -141,14 +143,16 @@ QJsonObject cacic_software::coletaDebian()
141 143  
142 144 packageJson["url"] = urlString.mid(1);
143 145 }
144   - if(line.contains("Installed-Size"))
  146 + if(line.contains("Installed-Size:"))
145 147 packageJson["installed_size"] = line.split(":")[1].mid(1);
146 148 }
147 149 softwaresJson[packageName] = packageJson;
  150 + int counterPackages = softwaresJson.size();
148 151 }
149 152  
150 153 return softwaresJson;
151 154 }
  155 +#endif
152 156  
153 157 QJsonObject cacic_software::toJsonObject()
154 158 {
... ...
src/cacic_software.h
... ... @@ -4,8 +4,11 @@
4 4 #include <ccacic.h>
5 5 #include <console.h>
6 6 #include <operatingsystem.h>
7   -#include <vqtconvert.h>
8   -#include <vregistry.h>
  7 +
  8 +#if defined(Q_OS_WIN)
  9 + #include <vqtconvert.h>
  10 + #include <vregistry.h>
  11 +#endif
9 12  
10 13 class cacic_software
11 14 {
... ...
src/vqtconvert.cpp
  1 +#if defined(Q_OS_WIN)
  2 +
1 3 #include "vqtconvert.h"
2 4  
3 5 #include <QString>
... ... @@ -58,3 +60,4 @@ namespace voidrealms
58 60  
59 61 } //end voidrealms::win32 namespace
60 62 } //end voidrealms namespace
  63 +#endif
... ...
src/vqtconvert.h
  1 +#if defined(Q_OS_WIN)
  2 +
1 3 #ifndef VQTCONVERT_H
2 4 #define VQTCONVERT_H
3 5  
... ... @@ -49,3 +51,4 @@ namespace voidrealms
49 51 } //end voidrealms::win32 namespace
50 52 } //end voidrealms namespace
51 53 #endif // VQTCONVERT_H
  54 +#endif
... ...
src/vregistry.cpp
  1 +#if defined(Q_OS_WIN)
  2 +
1 3 /*
2 4 Wrapper for the Windows Registry
3 5 Version: 1.0
... ... @@ -475,3 +477,4 @@ namespace voidrealms
475 477  
476 478 } //end voidrealms::win32 namespace
477 479 } //end voidrealms namespace
  480 +#endif
... ...
src/vregistry.h
  1 +#if defined(Q_OS_WIN)
  2 +
1 3 /*
2 4 Wrapper for the Windows Registry
3 5 Version: 1.0
... ... @@ -125,3 +127,4 @@ namespace voidrealms
125 127 } //end voidrealms::win32 namespace
126 128 } //end voidrealms namespace
127 129 #endif // VREGISTRY_H
  130 +#endif
... ...