Commit d4ccf4a1f0dcc67ff26e5361251be7351ab46f72
1 parent
f78ed3f8
Exists in
master
Consertos para rodar no Linux/Ubuntu.
Showing
7 changed files
with
32 additions
and
13 deletions
Show diff stats
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
src/vqtconvert.h
src/vregistry.cpp
src/vregistry.h