Commit d0bdc415ce6f66eefc114850f50698bdef24787a

Authored by Eric Menezes Noronha
1 parent a0da9800
Exists in master

Debug da função getOs; configuração dos projetos

cacic-teste/testcacic.cpp
... ... @@ -86,15 +86,8 @@ void CTestCacic::testInterfaceDeRede(){
86 86 }
87 87  
88 88 void CTestCacic::testpegarOS(){
89   - QVERIFY(OCacicComp.getOs() == CACIC_Computer::WIN_XP ||
90   - OCacicComp.getOs() == CACIC_Computer::WIN_VISTA ||
91   - OCacicComp.getOs() == CACIC_Computer::WIN_7 ||
92   - OCacicComp.getOs() == CACIC_Computer::WIN_8 ||
93   - OCacicComp.getOs() == CACIC_Computer::WIN_8_1 ||
94   - OCacicComp.getOs() == CACIC_Computer::MAC ||
95   - OCacicComp.getOs() == CACIC_Computer::LINUX_DEBIAN ||
96   - OCacicComp.getOs() == CACIC_Computer::LINUX_UBUNTU ||
97   - OCacicComp.getOs() == CACIC_Computer::LINUX_ARCH );
  89 + //basta que seja um retorno válido, não precisa validar todos.
  90 + QVERIFY(OCacicComp.getOs() != -1 );
98 91 }
99 92  
100 93 void CTestCacic::testPegarUsu(){
... ...
cacic/cacic.pro
... ... @@ -5,14 +5,30 @@
5 5 #-------------------------------------------------
6 6  
7 7 QT += core
8   -
9 8 QT -= gui
10 9  
11 10 TARGET = cacic
12 11 CONFIG += console
13 12 CONFIG -= app_bundle
14 13  
  14 +win32 {
  15 + LIBS += -LE:\LightBase\cacic-agente-project\cacic-agente\src\crypto++\lib -lcryptopp
  16 +} else {
  17 + LIBS += -L/usr/lib -lcryptopp
  18 +}
  19 +
15 20 TEMPLATE = app
16 21  
  22 +SOURCES += \
  23 + main.cpp \
  24 + ../src/ccacic.cpp \
  25 + ../src/cacic_computer.cpp
  26 +
  27 +
  28 +HEADERS += \
  29 + ../src/ccacic.h \
  30 + ../src/cacic_computer.h \
  31 + ../src/cacic_comm.h
17 32  
18   -SOURCES += main.cpp
  33 +INCLUDEPATH += ../src \
  34 + ../src/crypto++/include/
... ...
gercols/gercols.pro
... ... @@ -5,14 +5,31 @@
5 5 #-------------------------------------------------
6 6  
7 7 QT += core
8   -
  8 +QT += network
9 9 QT -= gui
10 10  
11 11 TARGET = gercols
12 12 CONFIG += console
13 13 CONFIG -= app_bundle
14 14  
  15 +win32 {
  16 + LIBS += -LE:\LightBase\cacic-agente-project\cacic-agente\src\crypto++\lib -lcryptopp
  17 +} else {
  18 + LIBS += -L/usr/lib -lcryptopp
  19 +}
  20 +
15 21 TEMPLATE = app
16 22  
  23 +SOURCES += \
  24 + main.cpp \
  25 + ../src/ccacic.cpp \
  26 + ../src/cacic_computer.cpp
  27 +
  28 +
  29 +HEADERS += \
  30 + ../src/ccacic.h \
  31 + ../src/cacic_computer.h \
  32 + ../src/cacic_comm.h
17 33  
18   -SOURCES += main.cpp
  34 +INCLUDEPATH += ../src \
  35 + ../src/crypto++/include/
... ...
src/cacic_computer.cpp
... ... @@ -74,20 +74,31 @@ QJsonObject CACIC_Computer::toJsonObject()
74 74 /*pegarOS
75 75 * @return: int;
76 76 * retorna um id referente a versão do SO.
  77 + * 48 = Windows XP
  78 + * 128 = Windows Vista
  79 + * 144 = Windows 7
  80 + * 160 = Windows 8
  81 + * 176 = Windows 8.1
  82 + * 200 = Linux
  83 + * 0 = unkown
77 84 */
78 85 int CACIC_Computer::pegarOS(){
79   -
80   -#if defined (Q_OS_WIN) || defined(Q_OS_CYGWIN)
81   - if(QSysInfo::WindowsVersion == QSysInfo::QSysInfo.WinVersion.WV_XP)
82   - return WIN_XP;
83   - else if(QSysInfo::WindowsVersion == QSysInfo::QSysInfo.WinVersion.WV_VISTA)
84   - return WIN_VISTA;
85   - else if(QSysInfo::WindowsVersion == QSysInfo::QSysInfo.WinVersion.WV_WINDOWS7)
86   - return WIN_7;
87   - else if(QSysInfo::WindowsVersion == QSysInfo::QSysInfo.WinVersion.WV_WINDOWS8)
88   - return WIN_8;
89   - else if(QSysInfo::WindowsVersion == QSysInfo::QSysInfo.WinVersion.WV_WINDOWS8_1)
90   - return WIN_8_1;
  86 +/*Não entendi o que você tentou fazer aqui, mas não funcionou.
  87 + * Você chegou a testar? Comenta o que era pra fazer.
  88 + */
  89 +//#if defined (Q_OS_WIN) || defined(Q_OS_CYGWIN)
  90 +// if(QSysInfo::WindowsVersion == QSysInfo::QSysInfo.WinVersion.WV_XP)
  91 +// return WIN_XP;
  92 +// else if(QSysInfo::WindowsVersion == QSysInfo::QSysInfo.WinVersion.WV_VISTA)
  93 +// return WIN_VISTA;
  94 +// else if(QSysInfo::WindowsVersion == QSysInfo::QSysInfo.WinVersion.WV_WINDOWS7)
  95 +// return WIN_7;
  96 +// else if(QSysInfo::WindowsVersion == QSysInfo::QSysInfo.WinVersion.WV_WINDOWS8)
  97 +// return WIN_8;
  98 +// else if(QSysInfo::WindowsVersion == QSysInfo::QSysInfo.WinVersion.WV_WINDOWS8_1)
  99 +// return WIN_8_1;
  100 +#if defined (Q_OS_WIN)
  101 + return QSysInfo::WindowsVersion;
91 102 #elif defined(Q_OS_MAC)
92 103 return MAC;
93 104 #elif defined (Q_OS_LINUX)
... ...