Ver código fonte

first

master
Robin Thoni 10 anos atrás
commit
f0e66f434f
71 arquivos alterados com 6355 adições e 0 exclusões
  1. 36
    0
      Epimafia/Epimafia.pro
  2. 274
    0
      Epimafia/epimafia.cpp
  3. 82
    0
      Epimafia/epimafia.h
  4. BIN
      Epimafia/epimafia.jpg
  5. 12
    0
      Epimafia/epimafia_global.h
  6. BIN
      Epimafia/icon.ico
  7. BIN
      Epimafia/icon.jpg
  8. BIN
      Epimafia/icon.png
  9. BIN
      Epimafia/icon_blue.jpg
  10. BIN
      Epimafia/icon_green.jpg
  11. BIN
      Epimafia/icon_red.jpg
  12. 165
    0
      Epimafia/intrabocal.cpp
  13. 57
    0
      Epimafia/intrabocal.h
  14. 575
    0
      Epimafia/netsoul.cpp
  15. 182
    0
      Epimafia/netsoul.h
  16. 10
    0
      Epimafia/rc.qrc
  17. 10
    0
      epimafia.pro
  18. 593
    0
      epimafia.pro.user
  19. 31
    0
      intrabocal/intrabocal.pro
  20. 245
    0
      intrabocal/intrabocal.pro.user
  21. 14
    0
      intrabocal/main.cpp
  22. 13
    0
      intrabocal/main.cpp~
  23. 1
    0
      intrabocal/rc.rc
  24. 194
    0
      intrabocal/widget.cpp
  25. 47
    0
      intrabocal/widget.h
  26. 290
    0
      intrabocal/widget.ui
  27. 58
    0
      netsoul/chatmanager.cpp
  28. 33
    0
      netsoul/chatmanager.h
  29. 81
    0
      netsoul/connectwidget.cpp
  30. 41
    0
      netsoul/connectwidget.h
  31. 317
    0
      netsoul/connectwidget.ui
  32. 107
    0
      netsoul/contactswidget.cpp
  33. 48
    0
      netsoul/contactswidget.h
  34. 73
    0
      netsoul/contactswidget.ui
  35. 53
    0
      netsoul/dialogaddcontact.cpp
  36. 40
    0
      netsoul/dialogaddcontact.h
  37. 48
    0
      netsoul/dialogaddcontact.ui
  38. 56
    0
      netsoul/dialogchat.cpp
  39. 43
    0
      netsoul/dialogchat.h
  40. 38
    0
      netsoul/dialogchat.ui
  41. 31
    0
      netsoul/dialogoptions.cpp
  42. 28
    0
      netsoul/dialogoptions.h
  43. 182
    0
      netsoul/dialogoptions.ui
  44. 14
    0
      netsoul/main.cpp
  45. 176
    0
      netsoul/mainwindow.cpp
  46. 53
    0
      netsoul/mainwindow.h
  47. 189
    0
      netsoul/mainwindow.ui
  48. 52
    0
      netsoul/netsoul.pro
  49. 93
    0
      netsoul/options.cpp
  50. 37
    0
      netsoul/options.h
  51. 1
    0
      netsoul/rc.rc
  52. 179
    0
      netsoul/usertreewidget.cpp
  53. 176
    0
      netsoul/usertreewidget.cpp~
  54. 37
    0
      netsoul/usertreewidget.h
  55. 11
    0
      ns_finder/main.cpp
  56. 38
    0
      ns_finder/netsoullistusers.cpp
  57. 32
    0
      ns_finder/netsoullistusers.h
  58. 29
    0
      ns_finder/ns_finder.pro
  59. 245
    0
      ns_finder/ns_finder.pro.user
  60. 1
    0
      ns_finder/rc.rc
  61. 130
    0
      ns_finder/widget.cpp
  62. 39
    0
      ns_finder/widget.h
  63. 160
    0
      ns_finder/widget.ui
  64. 11
    0
      usermgr/main.cpp
  65. 1
    0
      usermgr/rc.rc
  66. 30
    0
      usermgr/usermgr.pro
  67. 21
    0
      usermgr/version.h
  68. 74
    0
      usermgr/widget.cpp
  69. 33
    0
      usermgr/widget.h
  70. 26
    0
      usermgr/widget.h~
  71. 359
    0
      usermgr/widget.ui

+ 36
- 0
Epimafia/Epimafia.pro Ver arquivo

@@ -0,0 +1,36 @@
1
+#-------------------------------------------------
2
+#
3
+# Project created by QtCreator 2013-09-20T21:27:36
4
+#
5
+#-------------------------------------------------
6
+
7
+QT       -= gui
8
+QT += network webkit
9
+
10
+TARGET = Epimafia
11
+TEMPLATE = lib
12
+
13
+DEFINES += EPIMAFIA_LIBRARY
14
+
15
+SOURCES += epimafia.cpp \
16
+    netsoul.cpp \
17
+    intrabocal.cpp
18
+
19
+HEADERS += epimafia.h\
20
+        epimafia_global.h \
21
+    netsoul.h \
22
+    intrabocal.h
23
+
24
+unix:!symbian {
25
+    maemo5 {
26
+        target.path = /opt/usr/lib
27
+    } else {
28
+        target.path = /usr/lib
29
+    }
30
+    INSTALLS += target
31
+}
32
+
33
+LIBS += -lcrypto
34
+
35
+RESOURCES += \
36
+    rc.qrc

+ 274
- 0
Epimafia/epimafia.cpp Ver arquivo

@@ -0,0 +1,274 @@
1
+#include "epimafia.h"
2
+
3
+#ifdef Q_OS_WIN
4
+QSettings Epimafia::m_settings("epimafia.ini", QSettings::IniFormat);
5
+#else
6
+#error "OS specific"
7
+#endif
8
+
9
+unsigned char Epimafia::m_aesKey[] =
10
+{
11
+    0x55, 0x15, 0x58, 0x5d, 0x65, 0xf5, 0xe9, 0x15,
12
+    0x65, 0x43, 0x85, 0xa9, 0xb9, 0x98, 0x9e, 0xc9,
13
+    0xd0, 0x0a, 0x93, 0x15, 0x98, 0xff, 0xfe, 0x42
14
+};
15
+
16
+EpiUsers Epimafia::loadUsers()
17
+{
18
+    m_settings.sync();
19
+    EpiUsers users;
20
+    m_settings.beginGroup("Users");
21
+    foreach(QString login, m_settings.childGroups())
22
+    {
23
+        EpiUser u;
24
+        m_settings.beginGroup(login);
25
+        u.setLoginAes(QByteArray::fromHex(login.toStdString().c_str()));
26
+        u.setPasswordAes(m_settings.value("password").toByteArray());
27
+        u.setPwd_numAes(m_settings.value("pwd_num").toByteArray());
28
+        u.setPwd_pppAes(m_settings.value("pwd_ppp").toByteArray());
29
+        u.setPwd_socksAes(m_settings.value("pwd_socks").toByteArray());
30
+        m_settings.endGroup();
31
+        users.append(u);
32
+    }
33
+    m_settings.endGroup();
34
+    return users;
35
+}
36
+
37
+void Epimafia::saveUser(EpiUser user)
38
+{
39
+    saveUsers(EpiUsers() << user);
40
+}
41
+
42
+void Epimafia::saveUsers(EpiUsers users)
43
+{
44
+    m_settings.sync();
45
+    m_settings.beginGroup("Users");
46
+    foreach(EpiUser user, users)
47
+    {
48
+        if(!user.hasLogin())
49
+            user.setLogin(getUnknownUser());
50
+        m_settings.beginGroup(QString(user.getLoginAes().toHex()));
51
+        m_settings.setValue("password", user.getPasswordAes());
52
+        m_settings.setValue("pwd_num", user.getPwd_numAes());
53
+        m_settings.setValue("pwd_ppp", user.getPwd_pppAes());
54
+        m_settings.setValue("pwd_socks", user.getPwd_socksAes());
55
+        m_settings.endGroup();
56
+    }
57
+    m_settings.endGroup();
58
+}
59
+
60
+void Epimafia::removeUser(EpiUser user)
61
+{
62
+    m_settings.sync();
63
+    m_settings.beginGroup("Users");
64
+    m_settings.remove(user.getLoginAes().toHex());
65
+    m_settings.endGroup();
66
+}
67
+
68
+QByteArray Epimafia::aesEncrypt_16(QByteArray data)
69
+{
70
+    unsigned char* enc_out = (unsigned char *)malloc(16*sizeof(char));
71
+    AES_KEY enc_key;
72
+    AES_set_encrypt_key(m_aesKey, 128, &enc_key);
73
+    AES_encrypt((const unsigned char*)data.constData(), enc_out, &enc_key);
74
+    QByteArray aes((const char*)enc_out, 16);
75
+    delete enc_out;
76
+    return aes;
77
+}
78
+
79
+QByteArray Epimafia::aesDecrypt_16(QByteArray aes)
80
+{
81
+    unsigned char* dec_out = (unsigned char *)malloc(16*sizeof(char));
82
+    memset(dec_out, 0, 16);
83
+    AES_KEY dec_key;
84
+    AES_set_decrypt_key(m_aesKey,128,&dec_key);
85
+    AES_decrypt((const unsigned char*)aes.constData(), dec_out, &dec_key);
86
+    int s = 16;
87
+    for(int i = 15; i >= 0 && dec_out[i] == 0; --i)
88
+        --s;
89
+    QByteArray data((char *)dec_out, s);
90
+    delete dec_out;
91
+    return data;
92
+}
93
+
94
+QString Epimafia::getUnknownUser()
95
+{
96
+    bool end = false;
97
+    if(m_settings.group() != "Users")
98
+    {
99
+        end = true;
100
+        m_settings.beginGroup("Users");
101
+    }
102
+    QStringList users = m_settings.childGroups();
103
+    for(int i = 0; i < users.size(); ++i)
104
+        users.replace(i, Epimafia::aesDecrypt(QByteArray::fromHex(users.at(i).toStdString().c_str())));
105
+    int i = 1;
106
+    while(users.contains("UnknownUser" + QString::number(i)))
107
+        ++i;
108
+    if(end)
109
+        m_settings.endGroup();
110
+    return "UnknownUser" + QString::number(i);
111
+}
112
+
113
+QByteArray Epimafia::aesEncrypt(QString str)
114
+{
115
+    QByteArray aes;
116
+    QByteArray data = str.toUtf8();
117
+    if(data.size() % 16 != 0)
118
+        data += QByteArray(16 - (data.size() % 16), 0);
119
+    for(int i = 0; i != data.size(); i += 16)
120
+        aes += aesEncrypt_16(data.mid(i, 16));
121
+    return aes;
122
+}
123
+
124
+QString Epimafia::aesDecrypt(QByteArray aes)
125
+{
126
+    QByteArray data;
127
+    for(int i = 0; i < aes.size(); i += 16)
128
+        data += aesDecrypt_16(aes.mid(i, i + 16));
129
+    return QString::fromUtf8(data.constData(), data.size());
130
+}
131
+
132
+QDebug operator <<(QDebug dbg, const EpiUser & user)
133
+{
134
+    dbg.space()<<"("<<user.getLogin()<<user.getPassword()<<user.getPwd_num()<<user.getPwd_ppp()<<user.getPwd_socks()<<")";
135
+    return dbg.maybeSpace();
136
+}
137
+
138
+
139
+void EpiUser::setLoginAes(QByteArray login)
140
+{
141
+    m_login = login;
142
+}
143
+
144
+void EpiUser::setLogin(QString login)
145
+{
146
+    m_login = Epimafia::aesEncrypt(login);
147
+}
148
+
149
+QString EpiUser::getLogin() const
150
+{
151
+    return Epimafia::aesDecrypt(m_login);
152
+}
153
+
154
+QByteArray EpiUser::getLoginAes() const
155
+{
156
+    return m_login;
157
+}
158
+
159
+bool EpiUser::hasLogin() const
160
+{
161
+    return !m_login.isEmpty();
162
+}
163
+
164
+bool EpiUser::isUnknown() const
165
+{
166
+    return getLogin().contains(QRegExp("^UnknownUser([0-9]+)$"));
167
+}
168
+
169
+void EpiUser::setPasswordAes(QByteArray password)
170
+{
171
+    m_password = password;
172
+}
173
+
174
+void EpiUser::setPassword(QString password)
175
+{
176
+    m_password = Epimafia::aesEncrypt(password);
177
+}
178
+
179
+QString EpiUser::getPassword() const
180
+{
181
+    return Epimafia::aesDecrypt(m_password);
182
+}
183
+
184
+QByteArray EpiUser::getPasswordAes() const
185
+{
186
+    return m_password;
187
+}
188
+
189
+bool EpiUser::hasPassword() const
190
+{
191
+    return !m_password.isEmpty();
192
+}
193
+
194
+void EpiUser::setPwd_numAes(QByteArray pwd_num)
195
+{
196
+    m_pwd_num = pwd_num;
197
+}
198
+
199
+void EpiUser::setPwd_num(QString pwd_num)
200
+{
201
+    m_pwd_num = Epimafia::aesEncrypt(pwd_num);
202
+}
203
+
204
+QString EpiUser::getPwd_num() const
205
+{
206
+    return Epimafia::aesDecrypt(m_pwd_num);
207
+}
208
+
209
+QByteArray EpiUser::getPwd_numAes() const
210
+{
211
+    return m_pwd_num;
212
+}
213
+
214
+bool EpiUser::hasPwd_num() const
215
+{
216
+    return !m_pwd_num.isEmpty();
217
+}
218
+
219
+void EpiUser::setPwd_pppAes(QByteArray pwd_ppp)
220
+{
221
+    m_pwd_ppp = pwd_ppp;
222
+}
223
+
224
+void EpiUser::setPwd_ppp(QString pwd_ppp)
225
+{
226
+    m_pwd_ppp = Epimafia::aesEncrypt(pwd_ppp);
227
+}
228
+
229
+QString EpiUser::getPwd_ppp() const
230
+{
231
+    return Epimafia::aesDecrypt(m_pwd_ppp);
232
+}
233
+
234
+QByteArray EpiUser::getPwd_pppAes() const
235
+{
236
+    return m_pwd_ppp;
237
+}
238
+
239
+bool EpiUser::hasPwd_ppp() const
240
+{
241
+    return !m_pwd_ppp.isEmpty();
242
+}
243
+
244
+void EpiUser::setPwd_socksAes(QByteArray pwd_socks)
245
+{
246
+    m_pwd_socks = pwd_socks;
247
+}
248
+
249
+void EpiUser::setPwd_socks(QString pwd_socks)
250
+{
251
+    m_pwd_socks = Epimafia::aesEncrypt(pwd_socks);
252
+}
253
+
254
+QString EpiUser::getPwd_socks() const
255
+{
256
+    return Epimafia::aesDecrypt(m_pwd_socks);
257
+}
258
+
259
+QByteArray EpiUser::getPwd_socksAes() const
260
+{
261
+    return m_pwd_socks;
262
+}
263
+
264
+bool EpiUser::hasPwd_socks() const
265
+{
266
+    return !m_pwd_socks.isEmpty();
267
+}
268
+
269
+QVariant EpiUser::toVariant() const
270
+{
271
+    QVariant v;
272
+    v.setValue(*this);
273
+    return v;
274
+}

+ 82
- 0
Epimafia/epimafia.h Ver arquivo

@@ -0,0 +1,82 @@
1
+#ifndef EPIMAFIA_H
2
+#define EPIMAFIA_H
3
+
4
+#include "epimafia_global.h"
5
+#include <QString>
6
+#include <QList>
7
+#include <QSettings>
8
+#include <QStringList>
9
+#include <openssl/aes.h>
10
+#include <cstdio>
11
+#include <QDebug>
12
+
13
+class Epimafia;
14
+
15
+class EPIMAFIASHARED_EXPORT EpiUser
16
+{
17
+public:
18
+    void setLoginAes(QByteArray login);
19
+    void setLogin(QString login);
20
+    QString getLogin() const;
21
+    QByteArray getLoginAes() const;
22
+    bool hasLogin() const;
23
+    bool isUnknown() const;
24
+
25
+    void setPasswordAes(QByteArray password);
26
+    void setPassword(QString password);
27
+    QString getPassword() const;
28
+    QByteArray getPasswordAes() const;
29
+    bool hasPassword() const;
30
+
31
+    void setPwd_numAes(QByteArray pwd_num);
32
+    void setPwd_num(QString pwd_num);
33
+    QString getPwd_num() const;
34
+    QByteArray getPwd_numAes() const;
35
+    bool hasPwd_num() const;
36
+
37
+    void setPwd_pppAes(QByteArray pwd_ppp);
38
+    void setPwd_ppp(QString pwd_ppp);
39
+    QString getPwd_ppp() const;
40
+    QByteArray getPwd_pppAes() const;
41
+    bool hasPwd_ppp() const;
42
+
43
+    void setPwd_socksAes(QByteArray pwd_socks);
44
+    void setPwd_socks(QString pwd_socks);
45
+    QString getPwd_socks() const;
46
+    QByteArray getPwd_socksAes() const;
47
+    bool hasPwd_socks() const;
48
+
49
+    QVariant toVariant() const;
50
+
51
+private:
52
+    QByteArray m_login;
53
+    QByteArray m_password;
54
+    QByteArray m_pwd_num;
55
+    QByteArray m_pwd_ppp;
56
+    QByteArray m_pwd_socks;
57
+};
58
+typedef QList<EpiUser> EpiUsers;
59
+Q_DECLARE_METATYPE(EpiUser)
60
+
61
+class EPIMAFIASHARED_EXPORT Epimafia
62
+{
63
+
64
+public:
65
+    static EpiUsers loadUsers();
66
+    static void saveUser(EpiUser user);
67
+    static void saveUsers(EpiUsers users);
68
+    static void removeUser(EpiUser user);
69
+    static QByteArray aesEncrypt(QString str);
70
+    static QString aesDecrypt(QByteArray aes);
71
+    static QString getUnknownUser();
72
+
73
+private:
74
+    static QSettings m_settings;
75
+    static unsigned char m_aesKey[];
76
+    static QByteArray aesEncrypt_16(QByteArray data);
77
+    static QByteArray aesDecrypt_16(QByteArray aes);
78
+};
79
+
80
+QDebug EPIMAFIASHARED_EXPORT operator <<(QDebug dbg, const EpiUser&);
81
+
82
+#endif // EPIMAFIA_H

BIN
Epimafia/epimafia.jpg Ver arquivo


+ 12
- 0
Epimafia/epimafia_global.h Ver arquivo

@@ -0,0 +1,12 @@
1
+#ifndef EPIMAFIA_GLOBAL_H
2
+#define EPIMAFIA_GLOBAL_H
3
+
4
+#include <QtCore/qglobal.h>
5
+
6
+#if defined(EPIMAFIA_LIBRARY)
7
+#  define EPIMAFIASHARED_EXPORT Q_DECL_EXPORT
8
+#else
9
+#  define EPIMAFIASHARED_EXPORT Q_DECL_IMPORT
10
+#endif
11
+
12
+#endif // EPIMAFIA_GLOBAL_H

BIN
Epimafia/icon.ico Ver arquivo


BIN
Epimafia/icon.jpg Ver arquivo


BIN
Epimafia/icon.png Ver arquivo


BIN
Epimafia/icon_blue.jpg Ver arquivo


BIN
Epimafia/icon_green.jpg Ver arquivo


BIN
Epimafia/icon_red.jpg Ver arquivo


+ 165
- 0
Epimafia/intrabocal.cpp Ver arquivo

@@ -0,0 +1,165 @@
1
+#include "intrabocal.h"
2
+#include <QtWebKit>
3
+
4
+IntraBocal::IntraBocal(QObject *parent) : QObject(parent)
5
+{
6
+    m_mgr = new QNetworkAccessManager(this);
7
+}
8
+
9
+QList<City> IntraBocal::getCities()
10
+{
11
+    QList<QPair<QString, QString> > cities;
12
+
13
+    cities.append(City("", ""));
14
+    cities.append(City("bdx", "Bordeaux"));
15
+    cities.append(City("lil", "Lille"));
16
+    cities.append(City("lyo", "Lyon"));
17
+    cities.append(City("msl", "Marseille"));
18
+    cities.append(City("mpl", "Montpellier"));
19
+    cities.append(City("ncy", "Nancy"));
20
+    cities.append(City("nts", "Nantes"));
21
+    cities.append(City("nce", "Nice"));
22
+    cities.append(City("prs", "Paris"));
23
+    cities.append(City("rns", "Rennes"));
24
+    cities.append(City("stg", "Strasbourg"));
25
+    cities.append(City("tls", "Toulouse"));
26
+
27
+    return cities;
28
+}
29
+
30
+void IntraBocal::login(QString user, QString pass)
31
+{
32
+    if(!m_phpSessId.name().isEmpty())
33
+    {
34
+        emit logged();
35
+        return;
36
+    }
37
+    QNetworkRequest req(QUrl("https://intra-bocal.epitech.eu/index.php"));
38
+    QHttpMultiPart* data = new QHttpMultiPart(QHttpMultiPart::FormDataType, this);
39
+    addPart(data, "logout", "");
40
+    addPart(data, "login", user);
41
+    addPart(data, "pass", pass);
42
+    addPart(data, "submit", "Envoyer");
43
+    req.setHeader(QNetworkRequest::ContentTypeHeader, "multipart/form-data; boundary=" + QString(data->boundary()));
44
+    QNetworkReply* reply = m_mgr->post(req, data);
45
+    connect(reply, SIGNAL(destroyed()), data, SLOT(deleteLater()));
46
+    connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(loginError(QNetworkReply::NetworkError)));
47
+    connect(reply, SIGNAL(finished()), this, SLOT(loginFinished()));
48
+    connect(reply, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(loginSslError(QList<QSslError>)));
49
+}
50
+
51
+void IntraBocal::searchUser(QString lastName, QString firstName, QString login, QString promo, QString school, QString city)
52
+{
53
+    QNetworkRequest req(QUrl("https://intra-bocal.epitech.eu/index.php"));
54
+    QUrl data;
55
+    data.addQueryItem("pgid", "userinfo");
56
+    data.addQueryItem("m_userinfo_user_name", lastName);
57
+    data.addQueryItem("m_userinfo_user_firstname", firstName);
58
+    data.addQueryItem("m_userinfo_user_login", login);
59
+    data.addQueryItem("m_userinfo_user_prom", promo);
60
+    data.addQueryItem("m_userinfo_user_school", school);
61
+    data.addQueryItem("m_userinfo_user_town", city);
62
+    data.addQueryItem("m_userinfo_submit", "Rechercher");
63
+
64
+    req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
65
+    QVariant cookies;
66
+    cookies.setValue(QList<QNetworkCookie>() << m_phpSessId);
67
+    req.setHeader(QNetworkRequest::CookieHeader, cookies);
68
+
69
+    QNetworkReply* reply = m_mgr->post(req, data.toString().remove(0, 1).toStdString().c_str());
70
+    connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(searchError(QNetworkReply::NetworkError)));
71
+    connect(reply, SIGNAL(finished()), this, SLOT(searchFinished()));
72
+    connect(reply, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(searchSslError(QList<QSslError>)));
73
+}
74
+
75
+void IntraBocal::loginError(QNetworkReply::NetworkError e)
76
+{
77
+    emit error(NetworkError);
78
+}
79
+
80
+void IntraBocal::loginFinished()
81
+{
82
+    QNetworkReply* rep = qobject_cast<QNetworkReply*>(sender());
83
+    if(rep == 0)
84
+        return;
85
+
86
+    QList<QNetworkCookie> cookies = qvariant_cast<QList<QNetworkCookie> >(rep->header(QNetworkRequest::SetCookieHeader));
87
+    if(cookies.size() == 3)
88
+    {
89
+        for(int i = 0; i < cookies.size(); ++i)
90
+            if(cookies.at(i).name() == "PHPSESSID")
91
+            {
92
+                m_phpSessId = cookies.at(i);
93
+                emit logged();
94
+                return;
95
+            }
96
+    }
97
+    else if(!m_phpSessId.name().isEmpty() && cookies.size() == 2)
98
+        emit logged();
99
+    else
100
+        emit error(BadLogin);
101
+}
102
+
103
+void IntraBocal::loginSslError(QList<QSslError>)
104
+{
105
+    emit error(SslError);
106
+}
107
+
108
+void IntraBocal::searchError(QNetworkReply::NetworkError)
109
+{
110
+    emit error(NetworkError);
111
+}
112
+
113
+void IntraBocal::searchFinished()
114
+{
115
+    QNetworkReply* rep = qobject_cast<QNetworkReply*>(sender());
116
+    if(rep == 0)
117
+        return;
118
+
119
+    QString all = rep->readAll();
120
+
121
+    QWebView view;
122
+    view.hide();
123
+    view.setHtml(all);
124
+    QWebElement e = view.page()->mainFrame()->documentElement();
125
+    QWebElement nf = e.findFirst("div#main-copy div[id=\"error\"]");
126
+    if(!nf.isNull())
127
+    {
128
+        emit searchFinished(QList<QList<QString> >());
129
+        return;
130
+    }
131
+    e = e.findFirst("div#main-copy table[class=\"list_user\"] tbody");
132
+    if(e.isNull())
133
+        emit error(ParseError);
134
+    else
135
+    {
136
+        e = e.firstChild();
137
+        QList<QList<QString> > users;
138
+        while(!e.isNull())
139
+        {
140
+            QList<QString> user;
141
+            QWebElement c = e.firstChild();
142
+            while(!c.isNull())
143
+            {
144
+                user.append(c.toPlainText());
145
+                c = c.nextSibling();
146
+            }
147
+            users.append(user);
148
+            e = e.nextSibling();
149
+        }
150
+        emit searchFinished(users);
151
+    }
152
+}
153
+
154
+void IntraBocal::searchSslError(QList<QSslError>)
155
+{
156
+    emit error(SslError);
157
+}
158
+
159
+void IntraBocal::addPart(QHttpMultiPart *data, QString name, QString body)
160
+{
161
+    QHttpPart part;
162
+    part.setBody(QByteArray(body.toStdString().c_str()));
163
+    part.setHeader(QNetworkRequest::ContentDispositionHeader, "form-data; name=\"" + name + "\"");
164
+    data->append(part);
165
+}

+ 57
- 0
Epimafia/intrabocal.h Ver arquivo

@@ -0,0 +1,57 @@
1
+#ifndef INTRABOCAL_H
2
+#define INTRABOCAL_H
3
+
4
+#include <QObject>
5
+#include <QNetworkAccessManager>
6
+#include <QNetworkRequest>
7
+#include <QNetworkReply>
8
+#include <QSslError>
9
+#include <QHttpMultiPart>
10
+#include <QNetworkCookie>
11
+#include <QDebug>
12
+#include "epimafia_global.h"
13
+
14
+typedef QPair<QString, QString> City;
15
+
16
+class EPIMAFIASHARED_EXPORT IntraBocal : public QObject
17
+{
18
+    Q_OBJECT
19
+public:
20
+    enum Error
21
+    {
22
+        BadLogin,
23
+        SslError,
24
+        NetworkError,
25
+        ParseError
26
+    };
27
+
28
+    explicit IntraBocal(QObject *parent = 0);
29
+
30
+    static QList<City>getCities();
31
+    
32
+signals:
33
+    void error(IntraBocal::Error);
34
+    void logged();
35
+    void searchFinished(QList<QList<QString> >);
36
+    
37
+public slots:
38
+    void login(QString user, QString pass);
39
+    void searchUser(QString lastName, QString firstName, QString login, QString promo = QString(), QString school = QString(), QString city = QString());
40
+
41
+private slots:
42
+    void loginError(QNetworkReply::NetworkError e);
43
+    void loginFinished();
44
+    void loginSslError(QList<QSslError>);
45
+
46
+    void searchError(QNetworkReply::NetworkError);
47
+    void searchFinished();
48
+    void searchSslError(QList<QSslError>);
49
+
50
+private:
51
+    QNetworkAccessManager* m_mgr;
52
+    QNetworkCookie m_phpSessId;
53
+    void addPart(QHttpMultiPart* data, QString name, QString body);
54
+    
55
+};
56
+
57
+#endif // INTRABOCAL_H

+ 575
- 0
Epimafia/netsoul.cpp Ver arquivo

@@ -0,0 +1,575 @@
1
+#include "netsoul.h"
2
+
3
+int NetSoul::m_defaultTimeout = 1500;
4
+
5
+NetSoul::NetSoul(QObject *parent) : QObject(parent)
6
+{
7
+    m_sock = new QTcpSocket(this);
8
+    m_sock->setSocketOption(QAbstractSocket::KeepAliveOption, 1);
9
+    connect(m_sock, SIGNAL(hostFound()), this, SLOT(socketHostFound()));
10
+    connect(m_sock, SIGNAL(connected()), this, SLOT(socketConnected()));
11
+    connect(m_sock, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError)));
12
+    connect(m_sock, SIGNAL(readyRead()), this, SLOT(socketReadyRead()));
13
+    connect(m_sock, SIGNAL(disconnected()), this, SLOT(socketDisconnected()));
14
+    m_timeout = new QTimer(this);
15
+    m_timeout->setSingleShot(true);
16
+    connect(m_timeout, SIGNAL(timeout()), this, SLOT(timedout()));
17
+    m_state = Disconnected;
18
+    m_userState = Actif;
19
+    setLocation(QString());
20
+	m_data = "Epimafia NetSoul";
21
+}
22
+
23
+QAbstractSocket::SocketError NetSoul::getLastNetworkError()
24
+{
25
+    return m_lastNetworkError;
26
+}
27
+
28
+QString NetSoul::getId() const
29
+{
30
+    return m_id;
31
+}
32
+
33
+EpiUser NetSoul::getEpiUser() const
34
+{
35
+	return m_epiUser;
36
+}
37
+
38
+NetSoul::User NetSoul::getUser() const
39
+{
40
+	return m_user;
41
+}
42
+
43
+NetSoul::State NetSoul::getState() const
44
+{
45
+    return m_state;
46
+}
47
+
48
+NetSoul::UserState NetSoul::getUserStateFromString(QString state)
49
+{
50
+    state = state.toLower().trimmed();
51
+    if(state == "away")
52
+        return Away;
53
+    else if(state == "lock" || state == "locked")
54
+        return Lock;
55
+    else if(state == "actif")
56
+        return Actif;
57
+    else if(state == "connection" || state =="login")
58
+        return Login;
59
+    else if(state == "logout")
60
+        return Logout;
61
+    return UnknownState;
62
+}
63
+
64
+QString NetSoul::getStringFromUserState(NetSoul::UserState state)
65
+{
66
+    const QMetaObject & mo = NetSoul::staticMetaObject;
67
+    QMetaEnum me = mo.enumerator(mo.indexOfEnumerator("UserState"));
68
+    return me.valueToKey(state);
69
+}
70
+
71
+QString NetSoul::getDecodedString(QString enc)
72
+{
73
+    enc.replace("\\n", "\n");
74
+
75
+    int min = 0;
76
+    int i = -1;
77
+    while((i = enc.indexOf("%", min)) != -1)
78
+    {
79
+        bool ok = false;
80
+        int ch = enc.mid(i + 1, 2).toInt(&ok, 16);
81
+        if(ok)
82
+            enc.replace(i, 3, QChar::fromLatin1((char)ch));
83
+        else
84
+            min = i + 1;
85
+    }
86
+
87
+    return enc;
88
+}
89
+
90
+QString NetSoul::getEncodedString(QString dec)
91
+{
92
+    QString out;
93
+    foreach(QChar c, dec)
94
+    {
95
+        if((c.toAscii() >= 'a' && c.toAscii() <= 'z') || (c.toAscii() >= 'A' && c.toAscii() <= 'Z') || (c.toAscii() >= '0' && c.toAscii() <= '9'))
96
+            out += c;
97
+        else
98
+            out += "%" + QString::number((unsigned char)c.toLatin1(), 16);
99
+    }
100
+    return out;
101
+}
102
+
103
+QString NetSoul::getStringFromState(NetSoul::State state)
104
+{
105
+    const QMetaObject & mo = NetSoul::staticMetaObject;
106
+    QMetaEnum me = mo.enumerator(mo.indexOfEnumerator("State"));
107
+    return me.valueToKey(state);
108
+}
109
+
110
+void NetSoul::setLocation(QString l)
111
+{
112
+    if(l.isEmpty())
113
+        l = "Anywhere...";
114
+    m_location = l;
115
+}
116
+
117
+void NetSoul::setLogin(EpiUser user)
118
+{
119
+	m_epiUser = user;
120
+}
121
+
122
+void NetSoul::login(EpiUser user)
123
+{
124
+    setLogin(user);
125
+    login();
126
+}
127
+
128
+void NetSoul::login()
129
+{
130
+    if(m_state != Disconnected && m_state != ProtocolError && m_state != NetworkError && m_state != NetSoul::BadLogin)
131
+        return;
132
+    m_id.clear();
133
+    m_buf.clear();
134
+	m_nextCommands.clear();
135
+    m_currentCmd = NoCommand;
136
+    m_lastNetworkError = QAbstractSocket::UnknownSocketError;
137
+    setState(HostLookUp);
138
+    startTimeout();
139
+    m_sock->connectToHost("ns-server.epita.fr", 4242);
140
+}
141
+
142
+void NetSoul::logout()
143
+{
144
+    if(m_state == Disconnecting || m_state == Disconnected || m_state == ProtocolError || m_state == NetworkError || m_state == NetSoul::BadLogin)
145
+        return;
146
+    setState(Disconnecting);
147
+    if(m_state == Connecting)
148
+    {
149
+        m_sock->abort();
150
+        setState(Disconnected);
151
+    }
152
+    else
153
+        write("exit\n", 100);
154
+}
155
+
156
+void NetSoul::setUserState(NetSoul::UserState state)
157
+{
158
+    addCommand("state " + NetSoul::getStringFromUserState(state).toLower() + ":" + QString::number(QDateTime::currentDateTime().toTime_t()) + "\n", ChangeStatus, -1);
159
+}
160
+
161
+void NetSoul::whois(QString user)
162
+{
163
+    whois(QStringList() << user);
164
+}
165
+
166
+void NetSoul::whois(QStringList users)
167
+{
168
+    addCommand("user_cmd who {" + users.join(",") + "}\n", Whois);
169
+}
170
+
171
+void NetSoul::addToWatchList(QString user)
172
+{
173
+    addToWatchList(QStringList() << user);
174
+}
175
+
176
+void NetSoul::addToWatchList(QStringList users)
177
+{
178
+    addCommand("user_cmd watch_log_user {" + users.join(",") + "}\n", AddToWatchList, -1);
179
+}
180
+
181
+void NetSoul::listUsers(QObject* receiver, const char* member, QString user)
182
+{
183
+    NSListUsersEmitter* emitter = new NSListUsersEmitter(this);
184
+    connect(emitter, SIGNAL(listed(NetSoul::Users)), receiver, member);
185
+    m_listEmitters.append(emitter);
186
+    if(!user.isEmpty())
187
+        user.prepend(" ");
188
+    addCommand("list_users" + user + "\n", ListUsers);
189
+}
190
+
191
+void NetSoul::sendMessage(QString user, QString location, QString message)
192
+{
193
+	addCommand("user_cmd msg *:" + user + "@*" + getEncodedString(location) + "* msg " + getEncodedString(message) + "\n", SendMessage, -1);
194
+}
195
+
196
+void NetSoul::sendMessage(NetSoul::User user, QString message)
197
+{
198
+    sendMessage(user.login, user.location, message);
199
+}
200
+
201
+void NetSoul::socketConnected()
202
+{
203
+    setState(Connected);
204
+    startTimeout();
205
+}
206
+
207
+void NetSoul::socketDisconnected()
208
+{
209
+    if(m_state == Disconnected || m_state == ProtocolError || m_state == NetworkError || m_state == NetSoul::BadLogin)
210
+        return;
211
+    if(m_state == Disconnecting)
212
+        setState(Disconnected);
213
+    else
214
+        setState(ProtocolError);
215
+}
216
+
217
+void NetSoul::socketError(QAbstractSocket::SocketError e)
218
+{
219
+    if(m_state == Disconnected || m_state == Disconnecting)
220
+        return;
221
+    m_lastNetworkError = e;
222
+    setState(NetworkError);
223
+}
224
+
225
+void NetSoul::socketReadyRead()
226
+{
227
+    if(m_currentCmd != NoCommand)
228
+        startTimeout();
229
+    if(!m_sock->canReadLine() && !m_buf.contains('\n'))
230
+        return;
231
+
232
+    if(m_state == Connected)
233
+    {
234
+        QString salut = m_sock->readLine();
235
+        QRegExp reg("^salut ([0-9]+) ([0-9a-f]{32}) ([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}) ([0-9]{1,5}) ([0-9]+)\n$");
236
+        if(salut.indexOf(reg) != -1)
237
+        {
238
+			if(!m_epiUser.hasLogin())
239
+			{
240
+                setState(LoggedIn);
241
+                nextCommand();
242
+            }
243
+            else
244
+            {
245
+				m_user.data = m_data;
246
+				m_user.id = reg.cap(1);
247
+				m_user.ip = reg.cap(3);
248
+				m_user.location = m_location;
249
+				m_user.login = m_epiUser.getLogin();
250
+                setState(LoggingIn);
251
+				write("auth_ag ext_user none none\next_user_log " + m_epiUser.getLogin() + " " +
252
+					  QString(QCryptographicHash::hash(QString(reg.cap(2) + "-" + reg.cap(3) + "/" + reg.cap(4) + m_epiUser.getPwd_socks()).toStdString().c_str(), QCryptographicHash::Md5).toHex())
253
+					  + " " + getEncodedString(m_location) + " " + getEncodedString(m_data) + "\n");
254
+            }
255
+        }
256
+        else
257
+            protError();
258
+        return;
259
+    }
260
+    else if(m_state == LoggingIn)
261
+    {
262
+        m_buf += m_sock->readAll();
263
+        if(m_buf.count("\n") == 2)
264
+        {
265
+            if(m_buf == "rep 002 -- cmd end\nrep 002 -- cmd end\n")
266
+            {
267
+                setState(LoggedIn);
268
+                nextCommand();
269
+            }
270
+            else if(m_buf == "rep 002 -- cmd end\nrep 033 -- ext user identification fail\n")
271
+            {
272
+                setState(BadLogin);
273
+                m_sock->abort();
274
+            }
275
+            else
276
+                protError();
277
+            m_buf.clear();
278
+        }
279
+        return;
280
+    }
281
+    else if(m_state == LoggedIn)
282
+    {
283
+        QString d = m_sock->readAll();
284
+        m_buf += d;
285
+        if(m_currentCmd == Whois)
286
+        {
287
+            QRegExp user_cmd("^user_cmd ([^:]*):([^:]*):([^:]*):([^:]*):([^:]*):([^:]*):([^:\\|]*) \\| .* -- cmd end\n");
288
+            if(m_buf.contains(user_cmd))
289
+            {
290
+                m_buf.remove(0, user_cmd.cap().size());
291
+                foreach(QString cmd, user_cmd.cap().split("\n", QString::SkipEmptyParts))
292
+                {
293
+                    QRegExp get_cmd("^user_cmd ([^:]*):([^:]*):([^:]*):([^:]*):([^:]*):([^:]*):([^:\\|]*) \\| ");
294
+                    if(cmd.contains(get_cmd))
295
+                    {
296
+                        cmd.remove(0, get_cmd.cap().size());
297
+                        QRegExp reg("^who ([0-9]+) ([^ ]+) ([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}) ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+) ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+)$");
298
+                        if(cmd.contains(reg))
299
+                        {
300
+                            QStringList args = reg.capturedTexts();
301
+                            args.removeAt(0);
302
+                            for(int i = 0; i <= 4; ++i)
303
+                                args.removeAt(3);
304
+                            User usr;
305
+                            int i = 0;
306
+                            usr.id = args.at(i++);
307
+                            usr.login = args.at(i++);
308
+                            usr.ip = args.at(i++);
309
+                            usr.location = getDecodedString(args.at(i++));
310
+                            usr.promo = getDecodedString(args.at(i++));
311
+                            usr.stateString = args.at(i++).split(":").at(0);
312
+                            usr.state = getUserStateFromString(usr.stateString);
313
+                            usr.data = getDecodedString(args.at(i++));
314
+                            emit userDataChanged(usr);
315
+                        }
316
+                        else if(cmd != "who rep 002 -- cmd end")
317
+                        {
318
+                            protError();
319
+                            return;
320
+                        }
321
+                    }
322
+                    else
323
+                    {
324
+                        protError();
325
+                        return;
326
+                    }
327
+                }
328
+                commandFinished();
329
+            }
330
+            else
331
+                return;
332
+        }
333
+        else if(m_currentCmd == ListUsers)
334
+        {
335
+            QString cmdEnd = "rep 002 -- cmd end\n";
336
+            int index = m_buf.indexOf(cmdEnd);
337
+            if(index == -1)
338
+                return;
339
+            QString users = m_buf.left(index + cmdEnd.size());
340
+            m_buf.remove(0, users.size());
341
+            Users usrs;
342
+            foreach(QString user, users.split('\n', QString::SkipEmptyParts))
343
+            {
344
+                QRegExp reg("^([0-9]+) ([^ ]+) ([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}) ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+) ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+)$");
345
+                if(user.contains(reg))
346
+                {
347
+                    QStringList args = reg.capturedTexts();
348
+                    args.removeAt(0);
349
+                    for(int i = 0; i <= 4; ++i)
350
+                        args.removeAt(3);
351
+                    User usr;
352
+                    int i = 0;
353
+                    usr.id = args.at(i++);
354
+                    usr.login = args.at(i++);
355
+                    usr.ip = args.at(i++);
356
+                    usr.location = getDecodedString(args.at(i++));
357
+                    usr.promo = getDecodedString(args.at(i++));
358
+                    usr.stateString = args.at(i++).split(":").at(0);
359
+                    usr.state = getUserStateFromString(usr.stateString);
360
+                    usr.data = getDecodedString(args.at(i++));
361
+                    usrs.append(usr);
362
+                }
363
+                else if(user != "rep 002 -- cmd end")
364
+                {
365
+                    protError();
366
+                    return;
367
+                }
368
+            }
369
+            if(!m_listEmitters.isEmpty())
370
+            {
371
+                NSListUsersEmitter* emitter = m_listEmitters.at(0);
372
+                emitter->emitList(usrs);
373
+                emitter->deleteLater();
374
+                m_listEmitters.removeAt(0);
375
+            }
376
+            commandFinished();
377
+        }
378
+        else
379
+        {
380
+            QRegExp user_cmd("^user_cmd ([^:]*):([^:]*):([^:]*):([^:]*):([^:]*):([^:]*):([^:\\|]*) \\| ([^\n]+)\n");
381
+            QRegExp ping("^ping ([0-9]+) \n");
382
+            if(m_buf.contains(user_cmd))
383
+            {
384
+                m_buf.remove(0, user_cmd.cap().size());
385
+                User usr;
386
+                usr.id = user_cmd.cap(1);
387
+                usr.login = user_cmd.cap(4).split("@").at(0);
388
+                usr.ip = user_cmd.cap(4).split("@").at(1);
389
+                usr.location = getDecodedString(user_cmd.cap(6));
390
+                usr.promo = user_cmd.cap(7);
391
+                QString cmd = user_cmd.cap(8).trimmed();
392
+                QRegExp state("^state ([^ ]+):([0-9]+)$");
393
+                QRegExp msg("^msg ([^ ]*) dst=(.+)$");
394
+                if(cmd == "logout")
395
+                {
396
+                    usr.state = Logout;
397
+                    usr.stateString = getStringFromUserState(usr.state);
398
+                    emit userDataChanged(usr);
399
+                    commandFinished();
400
+                }
401
+                else if(cmd == "login")
402
+                {
403
+                    usr.state = Login;
404
+                    usr.stateString = getStringFromUserState(usr.state);
405
+                    emit userDataChanged(usr);
406
+                    commandFinished();
407
+                }
408
+                else if(cmd.contains(msg))
409
+                {
410
+                    Message message;
411
+                    message.from = usr;
412
+                    message.message = getDecodedString(msg.cap(1));
413
+                    emit newMessage(message);
414
+                    commandFinished();
415
+                }
416
+                else if(cmd.contains(state))
417
+                {
418
+                    usr.stateString = state.cap(1);
419
+                    usr.state = getUserStateFromString(usr.stateString);
420
+                    emit userDataChanged(usr);
421
+                    commandFinished();
422
+                }
423
+                else
424
+                    emit unknownCommand("user_cmd: " + cmd);
425
+            }
426
+            else if(m_buf.contains(ping))
427
+            {
428
+                m_buf.remove(0, ping.cap().size());
429
+                addCommand("ping\n", Ping, -1);
430
+            }
431
+            else
432
+            {
433
+                int i = m_buf.indexOf("\n");
434
+                emit unknownCommand(m_buf.left(i + 1));
435
+                m_buf.remove(0, i + 1);
436
+            }
437
+        }
438
+    }
439
+    else
440
+    {
441
+        m_buf.clear();
442
+        return;
443
+    }
444
+    socketReadyRead();
445
+}
446
+
447
+void NetSoul::socketHostFound()
448
+{
449
+    setState(Connecting);
450
+}
451
+
452
+void NetSoul::setState(NetSoul::State s)
453
+{
454
+    m_state = s;
455
+    emit stateChanged(m_state);
456
+}
457
+
458
+void NetSoul::protError()
459
+{
460
+    if(m_state == Disconnected || m_state == NetworkError || m_state == ProtocolError || m_state == NetSoul::BadLogin)
461
+        return;
462
+    setState(ProtocolError);
463
+    m_sock->abort();
464
+}
465
+
466
+void NetSoul::startTimeout()
467
+{
468
+    startTimeout(m_defaultTimeout);
469
+}
470
+
471
+void NetSoul::startTimeout(int t)
472
+{
473
+    m_timeout->start(t);
474
+}
475
+
476
+void NetSoul::stopTimeout()
477
+{
478
+    m_timeout->stop();
479
+}
480
+
481
+void NetSoul::write(QString c)
482
+{
483
+    write(c, m_defaultTimeout);
484
+}
485
+
486
+void NetSoul::write(QString c, int t)
487
+{
488
+    if(t != -1)
489
+        startTimeout(t);
490
+    m_sock->write(c.toAscii().constData());
491
+}
492
+
493
+void NetSoul::timedout()
494
+{
495
+    if(m_state == Disconnected || m_state == NetworkError || m_state == ProtocolError || m_state == NetSoul::BadLogin)
496
+        return;
497
+    if(m_state == Disconnecting)
498
+    {
499
+        setState(Disconnected);
500
+        m_sock->abort();
501
+        return;
502
+    }
503
+    m_lastNetworkError = QAbstractSocket::SocketTimeoutError;
504
+    setState(NetworkError);
505
+    m_sock->abort();
506
+}
507
+
508
+void NetSoul::nextCommand()
509
+{
510
+    stopTimeout();
511
+	if(m_currentCmd == NoCommand && !m_nextCommands.isEmpty() && (m_state == LoggedIn || (m_state == Connected && !m_epiUser.hasLogin())))
512
+    {
513
+        NextCommand cmd = m_nextCommands.at(0);
514
+        m_nextCommands.removeAt(0);
515
+        m_currentCmd = cmd.commandName;
516
+        write(cmd.commandString, cmd.timeout);
517
+        if(cmd.timeout == -1)
518
+        {
519
+            m_currentCmd = NoCommand;
520
+            nextCommand();
521
+        }
522
+    }
523
+}
524
+
525
+void NetSoul::addCommand(QString cmd, NetSoul::Command command)
526
+{
527
+    addCommand(cmd, command, m_defaultTimeout);
528
+}
529
+
530
+void NetSoul::addCommand(QString cmd, NetSoul::Command command, int t)
531
+{
532
+    NextCommand c;
533
+    c.commandName = command;
534
+    c.commandString = cmd;
535
+    c.timeout = t;
536
+    m_nextCommands.append(c);
537
+    nextCommand();
538
+}
539
+
540
+void NetSoul::commandFinished()
541
+{
542
+    m_currentCmd = NoCommand;
543
+    nextCommand();
544
+}
545
+
546
+QDebug operator<< (QDebug d, NetSoul::Command& cmd)
547
+{
548
+    const QMetaObject & mo = NetSoul::staticMetaObject;
549
+    QMetaEnum me = mo.enumerator(mo.indexOfEnumerator("Command"));
550
+    d<<me.valueToKey(cmd);
551
+    return d;
552
+}
553
+
554
+QDebug operator<< (QDebug d, NetSoul::State& state)
555
+{
556
+    return d << NetSoul::getStringFromState(state);
557
+}
558
+
559
+QDebug operator<< (QDebug d, NetSoul::UserState& state)
560
+{
561
+    return d << NetSoul::getStringFromUserState(state);
562
+}
563
+
564
+QDebug operator<< (QDebug d, NetSoul::User& user)
565
+{
566
+    d.nospace()<<"("<<user.id<<" "<<user.login.toStdString().c_str()<<"@"<<user.location.toStdString().c_str()
567
+              <<" "<<user.ip.toStdString().c_str()<<" "<<user.state<< (user.state == NetSoul::UnknownState ? " " + user.stateString : "")<<" "<<user.promo<<" "<<user.data<<")";
568
+    return d.maybeSpace();
569
+}
570
+
571
+
572
+void NSListUsersEmitter::emitList(NetSoul::Users users)
573
+{
574
+    emit listed(users);
575
+}

+ 182
- 0
Epimafia/netsoul.h Ver arquivo

@@ -0,0 +1,182 @@
1
+#ifndef NETSOUL_H
2
+#define NETSOUL_H
3
+
4
+#include <QObject>
5
+#include <QTcpSocket>
6
+#include <QRegExp>
7
+#include <QCryptographicHash>
8
+#include <QByteArray>
9
+#include <QUrl>
10
+#include <QMetaEnum>
11
+#include <QTimer>
12
+#include <QDateTime>
13
+#include <QDebug>
14
+#include <QStringList>
15
+#include "epimafia_global.h"
16
+#include "epimafia.h"
17
+
18
+class NSListUsersEmitter;
19
+
20
+class EPIMAFIASHARED_EXPORT NetSoul : public QObject
21
+{
22
+    Q_OBJECT
23
+public:
24
+    enum State
25
+    {
26
+        Disconnected,
27
+        HostLookUp,
28
+        Connecting,
29
+        Connected,
30
+        LoggingIn,
31
+        LoggedIn,
32
+        Disconnecting,
33
+        NetworkError,
34
+        ProtocolError,
35
+        BadLogin
36
+    };
37
+    Q_ENUMS(State)
38
+
39
+    enum UserState
40
+    {
41
+        UserStateNotSet,
42
+        UnknownState,
43
+        Actif,
44
+        Away,
45
+        Lock,
46
+        Logout,
47
+        Login
48
+    };
49
+    Q_ENUMS(UserState)
50
+
51
+    struct User
52
+    {
53
+        QString id;
54
+        QString login;
55
+        QString ip;
56
+        QString location;
57
+        QString promo;
58
+        UserState state;
59
+        QString stateString;
60
+        QString data;
61
+    };
62
+    typedef QList<NetSoul::User> Users;
63
+
64
+    struct Message
65
+    {
66
+        User from;
67
+        QString message;
68
+    };
69
+
70
+    enum Command
71
+    {
72
+        NoCommand,
73
+        Whois,
74
+        ChangeStatus,
75
+        AddToWatchList,
76
+        Ping,
77
+        ListUsers,
78
+        SendMessage
79
+    };
80
+    Q_ENUMS(Command)
81
+
82
+
83
+    explicit NetSoul(QObject *parent = 0);
84
+    QAbstractSocket::SocketError getLastNetworkError();
85
+    QString getId() const;
86
+	EpiUser getEpiUser() const;
87
+	User getUser() const;
88
+	NetSoul::State getState() const;
89
+
90
+    static UserState getUserStateFromString(QString state);
91
+    static QString getStringFromUserState(UserState state);
92
+    static QString getDecodedString(QString enc);
93
+    static QString getEncodedString(QString dec);
94
+    static QString getStringFromState(State state);
95
+    
96
+signals:
97
+    void stateChanged(NetSoul::State);
98
+    void userDataChanged(NetSoul::User);
99
+    void newMessage(NetSoul::Message);
100
+    void unknownCommand(QString);
101
+
102
+public slots:
103
+    void setLocation(QString l);
104
+    void setLogin(EpiUser user);
105
+    void login();
106
+    void login(EpiUser user);
107
+    void logout();
108
+    void setUserState(NetSoul::UserState state);
109
+    void whois(QString user);
110
+    void whois(QStringList users);
111
+    void addToWatchList(QString user);
112
+    void addToWatchList(QStringList users);
113
+    void listUsers(QObject *receiver, const char *member, QString user = QString());
114
+	void sendMessage(QString user, QString location, QString message);
115
+    void sendMessage(NetSoul::User user, QString message);
116
+
117
+private slots:
118
+    void socketConnected();
119
+    void socketDisconnected();
120
+    void socketError(QAbstractSocket::SocketError e);
121
+    void socketReadyRead();
122
+    void socketHostFound();
123
+    void setState(State s);
124
+    void protError();
125
+    void startTimeout();
126
+    void startTimeout(int t);
127
+    void stopTimeout();
128
+    void write(QString c);
129
+    void write(QString c, int t);
130
+    void timedout();
131
+    void nextCommand();
132
+    void addCommand(QString cmd, Command command);
133
+    void addCommand(QString cmd, Command command, int t);
134
+    void commandFinished();
135
+
136
+private:
137
+    struct NextCommand
138
+    {
139
+        QString commandString;
140
+        Command commandName;
141
+        int timeout;
142
+    };
143
+
144
+    static int m_defaultTimeout;
145
+
146
+    QTcpSocket* m_sock;
147
+	EpiUser m_epiUser;
148
+	User m_user;
149
+    QString m_location;
150
+    State m_state;
151
+    UserState m_userState;
152
+    QAbstractSocket::SocketError m_lastNetworkError;
153
+    QString m_buf;
154
+    QTimer* m_timeout;
155
+    QString m_id;
156
+    Command m_currentCmd;
157
+    QList<NextCommand> m_nextCommands;
158
+    QList<NSListUsersEmitter*> m_listEmitters;
159
+	QString m_data;
160
+    
161
+};
162
+Q_DECLARE_METATYPE(NetSoul::User)
163
+
164
+class NSListUsersEmitter : public QObject
165
+{
166
+    Q_OBJECT
167
+public:
168
+    NSListUsersEmitter(QObject* p = 0) : QObject(p) {}
169
+
170
+signals:
171
+    void listed(NetSoul::Users);
172
+
173
+public slots:
174
+    void emitList(NetSoul::Users users);
175
+};
176
+
177
+QDebug EPIMAFIASHARED_EXPORT operator<< (QDebug, NetSoul::Command&);
178
+QDebug EPIMAFIASHARED_EXPORT operator<< (QDebug, NetSoul::State&);
179
+QDebug EPIMAFIASHARED_EXPORT operator<< (QDebug, NetSoul::UserState&);
180
+QDebug EPIMAFIASHARED_EXPORT operator<< (QDebug, NetSoul::User&);
181
+
182
+#endif // NETSOUL_H

+ 10
- 0
Epimafia/rc.qrc Ver arquivo

@@ -0,0 +1,10 @@
1
+<RCC>
2
+    <qresource prefix="/epimafia" lang="fr">
3
+        <file>icon.png</file>
4
+        <file>epimafia.jpg</file>
5
+        <file>icon.jpg</file>
6
+        <file>icon_blue.jpg</file>
7
+        <file>icon_green.jpg</file>
8
+        <file>icon_red.jpg</file>
9
+    </qresource>
10
+</RCC>

+ 10
- 0
epimafia.pro Ver arquivo

@@ -0,0 +1,10 @@
1
+TEMPLATE = subdirs
2
+
3
+CONFIG += ordered
4
+
5
+SUBDIRS += \
6
+	Epimafia \
7
+    ns_finder \
8
+	intrabocal \
9
+	usermgr \
10
+	netsoul

+ 593
- 0
epimafia.pro.user Ver arquivo

@@ -0,0 +1,593 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE QtCreatorProject>
3
+<!-- Written by QtCreator 2.8.0, 2013-10-09T13:33:16. -->
4
+<qtcreator>
5
+ <data>
6
+  <variable>ProjectExplorer.Project.ActiveTarget</variable>
7
+  <value type="int">0</value>
8
+ </data>
9
+ <data>
10
+  <variable>ProjectExplorer.Project.EditorSettings</variable>
11
+  <valuemap type="QVariantMap">
12
+   <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
13
+   <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
14
+   <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
15
+   <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
16
+    <value type="QString" key="language">Cpp</value>
17
+    <valuemap type="QVariantMap" key="value">
18
+     <value type="QString" key="CurrentPreferences">CppGlobal</value>
19
+    </valuemap>
20
+   </valuemap>
21
+   <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
22
+    <value type="QString" key="language">QmlJS</value>
23
+    <valuemap type="QVariantMap" key="value">
24
+     <value type="QString" key="CurrentPreferences">QmlJSGlobal</value>
25
+    </valuemap>
26
+   </valuemap>
27
+   <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
28
+   <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
29
+   <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
30
+   <value type="int" key="EditorConfiguration.IndentSize">4</value>
31
+   <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
32
+   <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
33
+   <value type="int" key="EditorConfiguration.PaddingMode">1</value>
34
+   <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
35
+   <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
36
+   <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
37
+   <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
38
+   <value type="int" key="EditorConfiguration.TabSize">8</value>
39
+   <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
40
+   <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
41
+   <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
42
+   <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
43
+   <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
44
+   <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
45
+  </valuemap>
46
+ </data>
47
+ <data>
48
+  <variable>ProjectExplorer.Project.PluginSettings</variable>
49
+  <valuemap type="QVariantMap"/>
50
+ </data>
51
+ <data>
52
+  <variable>ProjectExplorer.Project.Target.0</variable>
53
+  <valuemap type="QVariantMap">
54
+   <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
55
+   <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
56
+   <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{996ad625-e724-4eb7-9ef9-5382382aeea5}</value>
57
+   <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
58
+   <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
59
+   <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">1</value>
60
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
61
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
62
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
63
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
64
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
65
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
66
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
67
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
68
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
69
+      <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
70
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
71
+     </valuemap>
72
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
73
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
74
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
75
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
76
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
77
+      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
78
+      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
79
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
80
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
81
+     </valuemap>
82
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
83
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Compiler</value>
84
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
85
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
86
+    </valuemap>
87
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
88
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
89
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
90
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
91
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
92
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
93
+      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
94
+      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
95
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
96
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
97
+     </valuemap>
98
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
99
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Nettoyer</value>
100
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
101
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
102
+    </valuemap>
103
+    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
104
+    <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
105
+    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
106
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
107
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
108
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
109
+    <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
110
+    <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">D:/prog/C++/bin/epimafia</value>
111
+    <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
112
+   </valuemap>
113
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
114
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
115
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
116
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
117
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
118
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
119
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
120
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
121
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
122
+      <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
123
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
124
+     </valuemap>
125
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
126
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
127
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
128
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
129
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
130
+      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
131
+      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
132
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
133
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
134
+     </valuemap>
135
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
136
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Compiler</value>
137
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
138
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
139
+    </valuemap>
140
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
141
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
142
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
143
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
144
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
145
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
146
+      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
147
+      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
148
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
149
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
150
+     </valuemap>
151
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
152
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Nettoyer</value>
153
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
154
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
155
+    </valuemap>
156
+    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
157
+    <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
158
+    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
159
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
160
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
161
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
162
+    <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
163
+    <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">D:/prog/C++/bin/epimafia</value>
164
+    <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
165
+   </valuemap>
166
+   <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
167
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
168
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
169
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
170
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
171
+      <value type="QString" key="ProjectExplorer.ProcessStep.Arguments"></value>
172
+      <value type="QString" key="ProjectExplorer.ProcessStep.Command">D:/prog/C++/bin/epimafia/deploy.bat</value>
173
+      <value type="QString" key="ProjectExplorer.ProcessStep.WorkingDirectory">%{buildDir}</value>
174
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Étape personnalisée</value>
175
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
176
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.ProcessStep</value>
177
+     </valuemap>
178
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
179
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Déploiement</value>
180
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
181
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
182
+    </valuemap>
183
+    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
184
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Déployer localement</value>
185
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
186
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
187
+   </valuemap>
188
+   <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
189
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
190
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
191
+    <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
192
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
193
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
194
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
195
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
196
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
197
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
198
+    <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
199
+    <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
200
+    <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
201
+    <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
202
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
203
+    <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
204
+    <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
205
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
206
+     <value type="int">0</value>
207
+     <value type="int">1</value>
208
+     <value type="int">2</value>
209
+     <value type="int">3</value>
210
+     <value type="int">4</value>
211
+     <value type="int">5</value>
212
+     <value type="int">6</value>
213
+     <value type="int">7</value>
214
+     <value type="int">8</value>
215
+     <value type="int">9</value>
216
+     <value type="int">10</value>
217
+     <value type="int">11</value>
218
+     <value type="int">12</value>
219
+     <value type="int">13</value>
220
+     <value type="int">14</value>
221
+    </valuelist>
222
+    <value type="int" key="PE.EnvironmentAspect.Base">2</value>
223
+    <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
224
+    <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
225
+    <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">D:/prog/C++/bin/epimafia/release/intrabocal.exe</value>
226
+    <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">false</value>
227
+    <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">D:/prog/C++/bin/epimafia/release/</value>
228
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Exécuter D:\prog\C++\bin\epimafia\release\intrabocal.exe</value>
229
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">intrabocal</value>
230
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
231
+    <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
232
+    <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
233
+    <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
234
+    <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
235
+    <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
236
+    <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
237
+   </valuemap>
238
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
239
+    <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
240
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
241
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
242
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
243
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
244
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
245
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
246
+    <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
247
+    <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
248
+    <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
249
+    <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
250
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
251
+    <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
252
+    <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
253
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
254
+     <value type="int">0</value>
255
+     <value type="int">1</value>
256
+     <value type="int">2</value>
257
+     <value type="int">3</value>
258
+     <value type="int">4</value>
259
+     <value type="int">5</value>
260
+     <value type="int">6</value>
261
+     <value type="int">7</value>
262
+     <value type="int">8</value>
263
+     <value type="int">9</value>
264
+     <value type="int">10</value>
265
+     <value type="int">11</value>
266
+     <value type="int">12</value>
267
+     <value type="int">13</value>
268
+     <value type="int">14</value>
269
+    </valuelist>
270
+    <value type="int" key="PE.EnvironmentAspect.Base">2</value>
271
+    <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
272
+    <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments">-debug</value>
273
+    <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">D:/prog/C++/bin/epimafia/release/netsoul.exe</value>
274
+    <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">false</value>
275
+    <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">D:/prog/C++/bin/epimafia/release/</value>
276
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Exécuter D:\prog\C++\bin\epimafia\release\netsoul.exe</value>
277
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">netsoul</value>
278
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
279
+    <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
280
+    <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
281
+    <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
282
+    <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
283
+    <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
284
+    <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
285
+   </valuemap>
286
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.2">
287
+    <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
288
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
289
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
290
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
291
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
292
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
293
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
294
+    <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
295
+    <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
296
+    <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
297
+    <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
298
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
299
+    <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
300
+    <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
301
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
302
+     <value type="int">0</value>
303
+     <value type="int">1</value>
304
+     <value type="int">2</value>
305
+     <value type="int">3</value>
306
+     <value type="int">4</value>
307
+     <value type="int">5</value>
308
+     <value type="int">6</value>
309
+     <value type="int">7</value>
310
+     <value type="int">8</value>
311
+     <value type="int">9</value>
312
+     <value type="int">10</value>
313
+     <value type="int">11</value>
314
+     <value type="int">12</value>
315
+     <value type="int">13</value>
316
+     <value type="int">14</value>
317
+    </valuelist>
318
+    <value type="int" key="PE.EnvironmentAspect.Base">2</value>
319
+    <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
320
+    <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments">-login bounio_g</value>
321
+    <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">D:/prog/C++/bin/epimafia/release/loginfinder.exe</value>
322
+    <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">false</value>
323
+    <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">D:/prog/C++/bin/epimafia/release/</value>
324
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Exécuter D:\prog\C++\bin\epimafia\release\loginfinder.exe</value>
325
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">loginfinder</value>
326
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
327
+    <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
328
+    <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
329
+    <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
330
+    <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
331
+    <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
332
+    <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
333
+   </valuemap>
334
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.3">
335
+    <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
336
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
337
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
338
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
339
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
340
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
341
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
342
+    <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
343
+    <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
344
+    <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
345
+    <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
346
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
347
+    <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
348
+    <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
349
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
350
+     <value type="int">0</value>
351
+     <value type="int">1</value>
352
+     <value type="int">2</value>
353
+     <value type="int">3</value>
354
+     <value type="int">4</value>
355
+     <value type="int">5</value>
356
+     <value type="int">6</value>
357
+     <value type="int">7</value>
358
+     <value type="int">8</value>
359
+     <value type="int">9</value>
360
+     <value type="int">10</value>
361
+     <value type="int">11</value>
362
+     <value type="int">12</value>
363
+     <value type="int">13</value>
364
+     <value type="int">14</value>
365
+    </valuelist>
366
+    <value type="int" key="PE.EnvironmentAspect.Base">2</value>
367
+    <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
368
+    <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
369
+    <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">D:/prog/C++/bin/epimafia/release/usermgr.exe</value>
370
+    <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">false</value>
371
+    <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">D:/prog/C++/bin/epimafia/release/</value>
372
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Exécuter D:\prog\C++\bin\epimafia\release\usermgr.exe</value>
373
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">usermgr</value>
374
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
375
+    <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
376
+    <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
377
+    <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
378
+    <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
379
+    <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
380
+    <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
381
+   </valuemap>
382
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.4">
383
+    <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
384
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
385
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
386
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
387
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
388
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
389
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
390
+    <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
391
+    <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
392
+    <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
393
+    <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
394
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
395
+    <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
396
+    <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
397
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
398
+     <value type="int">0</value>
399
+     <value type="int">1</value>
400
+     <value type="int">2</value>
401
+     <value type="int">3</value>
402
+     <value type="int">4</value>
403
+     <value type="int">5</value>
404
+     <value type="int">6</value>
405
+     <value type="int">7</value>
406
+     <value type="int">8</value>
407
+     <value type="int">9</value>
408
+     <value type="int">10</value>
409
+     <value type="int">11</value>
410
+     <value type="int">12</value>
411
+     <value type="int">13</value>
412
+     <value type="int">14</value>
413
+    </valuelist>
414
+    <value type="int" key="PE.EnvironmentAspect.Base">2</value>
415
+    <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
416
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">intrabocal</value>
417
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">intrabocal2</value>
418
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/prog/C++/epimafia/intrabocal/intrabocal.pro</value>
419
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
420
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">intrabocal/intrabocal.pro</value>
421
+    <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
422
+    <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
423
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
424
+    <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
425
+    <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
426
+    <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
427
+    <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
428
+    <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
429
+    <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
430
+   </valuemap>
431
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.5">
432
+    <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
433
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
434
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
435
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
436
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
437
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
438
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
439
+    <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
440
+    <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
441
+    <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
442
+    <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
443
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
444
+    <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
445
+    <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
446
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
447
+     <value type="int">0</value>
448
+     <value type="int">1</value>
449
+     <value type="int">2</value>
450
+     <value type="int">3</value>
451
+     <value type="int">4</value>
452
+     <value type="int">5</value>
453
+     <value type="int">6</value>
454
+     <value type="int">7</value>
455
+     <value type="int">8</value>
456
+     <value type="int">9</value>
457
+     <value type="int">10</value>
458
+     <value type="int">11</value>
459
+     <value type="int">12</value>
460
+     <value type="int">13</value>
461
+     <value type="int">14</value>
462
+    </valuelist>
463
+    <value type="int" key="PE.EnvironmentAspect.Base">2</value>
464
+    <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
465
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">netsoul</value>
466
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">netsoul2</value>
467
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/prog/C++/epimafia/netsoul/netsoul.pro</value>
468
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
469
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">netsoul/netsoul.pro</value>
470
+    <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
471
+    <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
472
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
473
+    <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
474
+    <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
475
+    <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
476
+    <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
477
+    <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
478
+    <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
479
+   </valuemap>
480
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.6">
481
+    <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
482
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
483
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
484
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
485
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
486
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
487
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
488
+    <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
489
+    <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
490
+    <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
491
+    <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
492
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
493
+    <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
494
+    <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
495
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
496
+     <value type="int">0</value>
497
+     <value type="int">1</value>
498
+     <value type="int">2</value>
499
+     <value type="int">3</value>
500
+     <value type="int">4</value>
501
+     <value type="int">5</value>
502
+     <value type="int">6</value>
503
+     <value type="int">7</value>
504
+     <value type="int">8</value>
505
+     <value type="int">9</value>
506
+     <value type="int">10</value>
507
+     <value type="int">11</value>
508
+     <value type="int">12</value>
509
+     <value type="int">13</value>
510
+     <value type="int">14</value>
511
+    </valuelist>
512
+    <value type="int" key="PE.EnvironmentAspect.Base">2</value>
513
+    <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
514
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">ns_finder</value>
515
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
516
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/prog/C++/epimafia/ns_finder/ns_finder.pro</value>
517
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
518
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">ns_finder/ns_finder.pro</value>
519
+    <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
520
+    <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
521
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
522
+    <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
523
+    <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
524
+    <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
525
+    <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
526
+    <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
527
+    <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
528
+   </valuemap>
529
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.7">
530
+    <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
531
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
532
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
533
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
534
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
535
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
536
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
537
+    <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
538
+    <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
539
+    <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
540
+    <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
541
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
542
+    <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
543
+    <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
544
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
545
+     <value type="int">0</value>
546
+     <value type="int">1</value>
547
+     <value type="int">2</value>
548
+     <value type="int">3</value>
549
+     <value type="int">4</value>
550
+     <value type="int">5</value>
551
+     <value type="int">6</value>
552
+     <value type="int">7</value>
553
+     <value type="int">8</value>
554
+     <value type="int">9</value>
555
+     <value type="int">10</value>
556
+     <value type="int">11</value>
557
+     <value type="int">12</value>
558
+     <value type="int">13</value>
559
+     <value type="int">14</value>
560
+    </valuelist>
561
+    <value type="int" key="PE.EnvironmentAspect.Base">2</value>
562
+    <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
563
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">usermgr</value>
564
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">usermgr2</value>
565
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/prog/C++/epimafia/usermgr/usermgr.pro</value>
566
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
567
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">usermgr/usermgr.pro</value>
568
+    <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
569
+    <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
570
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
571
+    <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
572
+    <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
573
+    <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
574
+    <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
575
+    <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
576
+    <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
577
+   </valuemap>
578
+   <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">8</value>
579
+  </valuemap>
580
+ </data>
581
+ <data>
582
+  <variable>ProjectExplorer.Project.TargetCount</variable>
583
+  <value type="int">1</value>
584
+ </data>
585
+ <data>
586
+  <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
587
+  <value type="QByteArray">{3074012e-28a1-4b99-a490-1fcbe7cc342f}</value>
588
+ </data>
589
+ <data>
590
+  <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
591
+  <value type="int">14</value>
592
+ </data>
593
+</qtcreator>

+ 31
- 0
intrabocal/intrabocal.pro Ver arquivo

@@ -0,0 +1,31 @@
1
+#-------------------------------------------------
2
+#
3
+# Project created by QtCreator 2013-09-18T15:11:51
4
+#
5
+#-------------------------------------------------
6
+
7
+QT       += core gui network
8
+
9
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
10
+
11
+TARGET = intrabocal
12
+TEMPLATE = app
13
+
14
+
15
+SOURCES += main.cpp\
16
+		widget.cpp
17
+
18
+HEADERS  += widget.h
19
+
20
+FORMS    += widget.ui
21
+
22
+RC_FILE = rc.rc
23
+
24
+RESOURCES +=
25
+
26
+win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../Epimafia/release/ -lEpimafia
27
+else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../Epimafia/debug/ -lEpimafia
28
+else:unix: LIBS += -L$$OUT_PWD/../Epimafia/ -lEpimafia
29
+
30
+INCLUDEPATH += $$PWD/../Epimafia
31
+DEPENDPATH += $$PWD/../Epimafia

+ 245
- 0
intrabocal/intrabocal.pro.user Ver arquivo

@@ -0,0 +1,245 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE QtCreatorProject>
3
+<!-- Written by QtCreator 2.8.0, 2013-09-18T22:21:50. -->
4
+<qtcreator>
5
+ <data>
6
+  <variable>ProjectExplorer.Project.ActiveTarget</variable>
7
+  <value type="int">0</value>
8
+ </data>
9
+ <data>
10
+  <variable>ProjectExplorer.Project.EditorSettings</variable>
11
+  <valuemap type="QVariantMap">
12
+   <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
13
+   <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
14
+   <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
15
+   <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
16
+    <value type="QString" key="language">Cpp</value>
17
+    <valuemap type="QVariantMap" key="value">
18
+     <value type="QString" key="CurrentPreferences">CppGlobal</value>
19
+    </valuemap>
20
+   </valuemap>
21
+   <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
22
+    <value type="QString" key="language">QmlJS</value>
23
+    <valuemap type="QVariantMap" key="value">
24
+     <value type="QString" key="CurrentPreferences">QmlJSGlobal</value>
25
+    </valuemap>
26
+   </valuemap>
27
+   <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
28
+   <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
29
+   <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
30
+   <value type="int" key="EditorConfiguration.IndentSize">4</value>
31
+   <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
32
+   <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
33
+   <value type="int" key="EditorConfiguration.PaddingMode">1</value>
34
+   <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
35
+   <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
36
+   <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
37
+   <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
38
+   <value type="int" key="EditorConfiguration.TabSize">8</value>
39
+   <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
40
+   <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
41
+   <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
42
+   <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
43
+   <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
44
+   <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
45
+  </valuemap>
46
+ </data>
47
+ <data>
48
+  <variable>ProjectExplorer.Project.PluginSettings</variable>
49
+  <valuemap type="QVariantMap"/>
50
+ </data>
51
+ <data>
52
+  <variable>ProjectExplorer.Project.Target.0</variable>
53
+  <valuemap type="QVariantMap">
54
+   <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
55
+   <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
56
+   <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{996ad625-e724-4eb7-9ef9-5382382aeea5}</value>
57
+   <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
58
+   <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
59
+   <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
60
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
61
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
62
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
63
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
64
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
65
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
66
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
67
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
68
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
69
+      <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
70
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
71
+     </valuemap>
72
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
73
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
74
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
75
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
76
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
77
+      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
78
+      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
79
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
80
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
81
+     </valuemap>
82
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
83
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Compiler</value>
84
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
85
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
86
+    </valuemap>
87
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
88
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
89
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
90
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
91
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
92
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
93
+      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
94
+      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
95
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
96
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
97
+     </valuemap>
98
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
99
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Nettoyer</value>
100
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
101
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
102
+    </valuemap>
103
+    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
104
+    <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
105
+    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
106
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
107
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
108
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
109
+    <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
110
+    <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">D:/prog/C++/bin/intrabocal</value>
111
+    <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
112
+   </valuemap>
113
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
114
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
115
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
116
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
117
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
118
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
119
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
120
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
121
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
122
+      <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
123
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
124
+     </valuemap>
125
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
126
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
127
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
128
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
129
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
130
+      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
131
+      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
132
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
133
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
134
+     </valuemap>
135
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
136
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Compiler</value>
137
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
138
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
139
+    </valuemap>
140
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
141
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
142
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
143
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
144
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
145
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
146
+      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
147
+      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
148
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
149
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
150
+     </valuemap>
151
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
152
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Nettoyer</value>
153
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
154
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
155
+    </valuemap>
156
+    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
157
+    <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
158
+    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
159
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
160
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
161
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
162
+    <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
163
+    <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">D:/prog/C++/bin/intrabocal</value>
164
+    <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
165
+   </valuemap>
166
+   <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
167
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
168
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
169
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
170
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Déploiement</value>
171
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
172
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
173
+    </valuemap>
174
+    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
175
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Déployer localement</value>
176
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
177
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
178
+   </valuemap>
179
+   <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
180
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
181
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
182
+    <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
183
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
184
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
185
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
186
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
187
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
188
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
189
+    <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
190
+    <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
191
+    <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
192
+    <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
193
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
194
+    <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
195
+    <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
196
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
197
+     <value type="int">0</value>
198
+     <value type="int">1</value>
199
+     <value type="int">2</value>
200
+     <value type="int">3</value>
201
+     <value type="int">4</value>
202
+     <value type="int">5</value>
203
+     <value type="int">6</value>
204
+     <value type="int">7</value>
205
+     <value type="int">8</value>
206
+     <value type="int">9</value>
207
+     <value type="int">10</value>
208
+     <value type="int">11</value>
209
+     <value type="int">12</value>
210
+     <value type="int">13</value>
211
+     <value type="int">14</value>
212
+    </valuelist>
213
+    <value type="int" key="PE.EnvironmentAspect.Base">2</value>
214
+    <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
215
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">intrabocal</value>
216
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
217
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/prog/C++/intrabocal/intrabocal.pro</value>
218
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
219
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">intrabocal.pro</value>
220
+    <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
221
+    <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
222
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
223
+    <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
224
+    <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
225
+    <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
226
+    <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
227
+    <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
228
+    <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
229
+   </valuemap>
230
+   <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
231
+  </valuemap>
232
+ </data>
233
+ <data>
234
+  <variable>ProjectExplorer.Project.TargetCount</variable>
235
+  <value type="int">1</value>
236
+ </data>
237
+ <data>
238
+  <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
239
+  <value type="QByteArray">{3074012e-28a1-4b99-a490-1fcbe7cc342f}</value>
240
+ </data>
241
+ <data>
242
+  <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
243
+  <value type="int">14</value>
244
+ </data>
245
+</qtcreator>

+ 14
- 0
intrabocal/main.cpp Ver arquivo

@@ -0,0 +1,14 @@
1
+#include "widget.h"
2
+#include <QApplication>
3
+#include "epimafia.h"
4
+#include "QTextCodec"
5
+
6
+int main(int argc, char *argv[])
7
+{
8
+    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
9
+    QApplication a(argc, argv);
10
+    Widget w;
11
+    w.show();
12
+    
13
+    return a.exec();
14
+}

+ 13
- 0
intrabocal/main.cpp~ Ver arquivo

@@ -0,0 +1,13 @@
1
+#include "widget.h"
2
+#include <QApplication>
3
+#include "epimafia.h"
4
+
5
+int main(int argc, char *argv[])
6
+{
7
+    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
8
+    QApplication a(argc, argv);
9
+    Widget w;
10
+    w.show();
11
+    
12
+    return a.exec();
13
+}

+ 1
- 0
intrabocal/rc.rc Ver arquivo

@@ -0,0 +1 @@
1
+IDI_ICON1               ICON    DISCARDABLE     "../Epimafia/icon.ico"

+ 194
- 0
intrabocal/widget.cpp Ver arquivo

@@ -0,0 +1,194 @@
1
+#include "widget.h"
2
+#include "ui_widget.h"
3
+
4
+Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
5
+{
6
+    ui->setupUi(this);
7
+
8
+    /*EpiUser usr;
9
+    usr.setLogin("azerty_u");
10
+    usr.setPwd_ppp("psswd");
11
+    Epimafia::saveUser(usr);
12
+    usr.setLogin("");
13
+    usr.setPwd_ppp("ppp");
14
+    Epimafia::saveUser(usr);
15
+    usr.setLogin("login_x");
16
+    Epimafia::saveUser(usr);*/
17
+
18
+    m_currentUser = 0;
19
+
20
+    foreach(QLineEdit* line, findChildren<QLineEdit*>())
21
+        connect(line, SIGNAL(returnPressed()), this, SLOT(search()));
22
+    m_intra = new IntraBocal(this);
23
+    connect(m_intra, SIGNAL(error(IntraBocal::Error)), this, SLOT(intraError(IntraBocal::Error)));
24
+    connect(m_intra, SIGNAL(logged()), this, SLOT(intraLogged()));
25
+    connect(m_intra, SIGNAL(searchFinished(QList<QList<QString> >)), this, SLOT(intraSearchFinished(QList<QList<QString> >)));
26
+    foreach(City city, IntraBocal::getCities())
27
+        ui->comboBox->addItem(city.second, city.first);
28
+
29
+    loadUsers();
30
+
31
+    QStringList args = qApp->arguments();
32
+    for(int i = 1; i < args.size() - 1; ++i)
33
+    {
34
+        QString arg = args.at(i);
35
+        if(arg == "-firstName")
36
+            ui->lineFirstName->setText(args.at(++i));
37
+        else if(arg == "-lastName")
38
+            ui->lineLastName->setText(args.at(++i));
39
+        else if(arg == "-login")
40
+            ui->lineLogin->setText(args.at(++i));
41
+        else if(arg == "-promo")
42
+            ui->linePromo->setText(args.at(++i));
43
+        else if(arg == "-school")
44
+            ui->lineSchool->setText(args.at(++i));
45
+    }
46
+    if(!ui->lineFirstName->text().isEmpty() || !ui->lineLastName->text().isEmpty() || !ui->lineLogin->text().isEmpty() || !ui->linePromo->text().isEmpty() || !ui->lineSchool->text().isEmpty())
47
+        search();
48
+
49
+}
50
+
51
+Widget::~Widget()
52
+{
53
+    delete ui;
54
+}
55
+
56
+void Widget::paintEvent(QPaintEvent *)
57
+{
58
+    resizeToMin();
59
+}
60
+
61
+void Widget::search(bool badLogin)
62
+{
63
+    if(m_users.isEmpty())
64
+    {
65
+        askStartUsrMgr();
66
+        return;
67
+    }
68
+    if(badLogin)
69
+        ui->labelStatus->setText("Bad Loggin. Trying Another...");
70
+    else
71
+        ui->labelStatus->setText("Logging in...");
72
+    EpiUser usr = m_users.at(m_currentUser);
73
+    m_intra->login(usr.getLogin(), usr.getPwd_ppp());
74
+    clearLayout(ui->gridLayout);
75
+}
76
+
77
+void Widget::loadUsers()
78
+{
79
+    m_users = Epimafia::loadUsers();
80
+    for(int i = 0; i < m_users.size(); ++i)
81
+    {
82
+        EpiUser usr = m_users.at(i);
83
+        if(!usr.hasLogin() || usr.isUnknown() || !usr.hasPwd_ppp())
84
+            m_users.removeAt(i--);
85
+    }
86
+    m_currentUser = 0;
87
+}
88
+
89
+void Widget::askStartUsrMgr()
90
+{
91
+    QMessageBox* msg = new QMessageBox(this);
92
+    msg->setIcon(QMessageBox::Question);
93
+    msg->setWindowTitle("No logins found");
94
+    msg->setText("No logins with ppp are available.\nDo you want to open User Manager to create one?");
95
+    connect(msg->addButton(QMessageBox::Yes), SIGNAL(clicked()), this, SLOT(startUsrMgr()));
96
+    connect(msg->addButton(QMessageBox::No), SIGNAL(clicked()), this, SLOT(loadUsers()));
97
+    msg->show();
98
+}
99
+
100
+void Widget::startUsrMgr()
101
+{
102
+    QProcess* p = new QProcess(this);
103
+    connect(p, SIGNAL(finished(int)), this, SLOT(processFinished(int)));
104
+	QString exe;
105
+#ifdef Q_OS_WIN
106
+	exe = "usermgr.exe";
107
+#else
108
+#error "OS specific"
109
+#endif
110
+	p->start(exe);
111
+}
112
+
113
+void Widget::intraError(IntraBocal::Error e)
114
+{
115
+    if(e == IntraBocal::BadLogin)
116
+    {
117
+        ui->labelStatus->setText("#BadLogin#");
118
+        ++m_currentUser;
119
+        if(m_currentUser < m_users.size())
120
+            search(true);
121
+        else
122
+            askStartUsrMgr();
123
+    }
124
+    else if(e == IntraBocal::NetworkError)
125
+        ui->labelStatus->setText("#NetworkError#");
126
+    else if(e == IntraBocal::ParseError)
127
+        ui->labelStatus->setText("#ParseError#");
128
+    else if(e == IntraBocal::SslError)
129
+        ui->labelStatus->setText("#SslError#");
130
+}
131
+
132
+void Widget::intraLogged()
133
+{
134
+    ui->labelStatus->setText("Logged in. Searching...");
135
+    m_intra->searchUser(ui->lineLastName->text(), ui->lineFirstName->text(), ui->lineLogin->text(), ui->linePromo->text(),
136
+                        ui->lineSchool->text(), ui->comboBox->itemData(ui->comboBox->currentIndex()).toString());
137
+}
138
+
139
+void Widget::intraSearchFinished(QList<QList<QString> > users)
140
+{
141
+    if(users.isEmpty())
142
+    {
143
+        ui->labelStatus->setText("No results");
144
+        return;
145
+    }
146
+    QList<QString> header = users.at(0);
147
+    for(int c = 0; c < header.size(); ++c)
148
+    {
149
+        QLabel* lbl = new QLabel();
150
+        QFont f = lbl->font();
151
+        f.setBold(true);
152
+        lbl->setFont(f);
153
+        lbl->setText(header.at(c));
154
+        ui->gridLayout->addWidget(lbl, 0, c);
155
+    }
156
+    for(int i = 1; i < users.size(); ++i)
157
+    {
158
+        QList<QString> user = users.at(i);
159
+        for(int c = 0; c < user.size(); ++c)
160
+        {
161
+            QLabel* lbl = new QLabel();
162
+            lbl->setText(user.at(c));
163
+            ui->gridLayout->addWidget(lbl, i, c);
164
+        }
165
+    }
166
+    ui->labelStatus->setText("idle");
167
+}
168
+
169
+void Widget::resizeToMin()
170
+{
171
+    resize(minimumSizeHint());
172
+    setFixedSize(size());
173
+}
174
+
175
+void Widget::processFinished(int)
176
+{
177
+    sender()->deleteLater();
178
+    search();
179
+}
180
+
181
+void Widget::clearLayout(QLayout *layout)
182
+{
183
+    QLayoutItem *item;
184
+    while((item = layout->takeAt(0))) {
185
+        if (item->layout()) {
186
+            clearLayout(item->layout());
187
+            delete item->layout();
188
+        }
189
+        if (item->widget()) {
190
+            delete item->widget();
191
+        }
192
+        delete item;
193
+    }
194
+}

+ 47
- 0
intrabocal/widget.h Ver arquivo

@@ -0,0 +1,47 @@
1
+#ifndef WIDGET_H
2
+#define WIDGET_H
3
+
4
+#include <QWidget>
5
+#include <QProcess>
6
+#include <QMessageBox>
7
+#include <QPushButton>
8
+#include "intrabocal.h"
9
+#include "epimafia.h"
10
+
11
+namespace Ui {
12
+class Widget;
13
+}
14
+
15
+class Widget : public QWidget
16
+{
17
+    Q_OBJECT
18
+    
19
+public:
20
+    explicit Widget(QWidget *parent = 0);
21
+    ~Widget();
22
+
23
+protected:
24
+    void paintEvent(QPaintEvent *);
25
+
26
+public slots:
27
+    void search(bool badLogin = false);
28
+    void loadUsers();
29
+    void askStartUsrMgr();
30
+    void startUsrMgr();
31
+
32
+private slots:
33
+    void intraError(IntraBocal::Error e);
34
+    void intraLogged();
35
+    void intraSearchFinished(QList<QList<QString> > users);
36
+    void resizeToMin();
37
+    void processFinished(int);
38
+    
39
+private:
40
+    Ui::Widget *ui;
41
+    IntraBocal* m_intra;
42
+    EpiUsers m_users;
43
+    int m_currentUser;
44
+    void clearLayout(QLayout *layout);
45
+};
46
+
47
+#endif // WIDGET_H

+ 290
- 0
intrabocal/widget.ui Ver arquivo

@@ -0,0 +1,290 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<ui version="4.0">
3
+ <class>Widget</class>
4
+ <widget class="QWidget" name="Widget">
5
+  <property name="geometry">
6
+   <rect>
7
+    <x>0</x>
8
+    <y>0</y>
9
+    <width>409</width>
10
+    <height>193</height>
11
+   </rect>
12
+  </property>
13
+  <property name="windowTitle">
14
+   <string>Intra-bocal - Epimafia</string>
15
+  </property>
16
+  <property name="windowIcon">
17
+   <iconset>
18
+    <normaloff>:/icon.jpg</normaloff>:/icon.jpg</iconset>
19
+  </property>
20
+  <property name="styleSheet">
21
+   <string notr="true">QWidget
22
+{
23
+background-color: black;
24
+color: white;
25
+}
26
+QPushButton
27
+{
28
+border: 1px solid white;
29
+border-radius: 5px;
30
+width: 50px;
31
+height: 20px;
32
+}
33
+QPushButton:hover
34
+{
35
+	background-color:rgb(71, 71, 71);
36
+}
37
+QPushButton:pressed
38
+{
39
+	background-color:rgb(42, 42, 42);
40
+}</string>
41
+  </property>
42
+  <layout class="QVBoxLayout" name="verticalLayout">
43
+   <item>
44
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
45
+     <item>
46
+      <spacer name="horizontalSpacer">
47
+       <property name="orientation">
48
+        <enum>Qt::Horizontal</enum>
49
+       </property>
50
+       <property name="sizeHint" stdset="0">
51
+        <size>
52
+         <width>40</width>
53
+         <height>20</height>
54
+        </size>
55
+       </property>
56
+      </spacer>
57
+     </item>
58
+     <item>
59
+      <widget class="QLabel" name="label_7">
60
+       <property name="minimumSize">
61
+        <size>
62
+         <width>150</width>
63
+         <height>75</height>
64
+        </size>
65
+       </property>
66
+       <property name="maximumSize">
67
+        <size>
68
+         <width>150</width>
69
+         <height>75</height>
70
+        </size>
71
+       </property>
72
+       <property name="text">
73
+        <string/>
74
+       </property>
75
+       <property name="pixmap">
76
+        <pixmap resource="../Epimafia/rc.qrc">:/epimafia/epimafia.jpg</pixmap>
77
+       </property>
78
+       <property name="scaledContents">
79
+        <bool>true</bool>
80
+       </property>
81
+      </widget>
82
+     </item>
83
+     <item>
84
+      <spacer name="horizontalSpacer_2">
85
+       <property name="orientation">
86
+        <enum>Qt::Horizontal</enum>
87
+       </property>
88
+       <property name="sizeHint" stdset="0">
89
+        <size>
90
+         <width>40</width>
91
+         <height>20</height>
92
+        </size>
93
+       </property>
94
+      </spacer>
95
+     </item>
96
+    </layout>
97
+   </item>
98
+   <item>
99
+    <widget class="QWidget" name="widgetStatus" native="true">
100
+     <layout class="QHBoxLayout" name="horizontalLayout_3">
101
+      <property name="topMargin">
102
+       <number>0</number>
103
+      </property>
104
+      <property name="bottomMargin">
105
+       <number>0</number>
106
+      </property>
107
+      <item>
108
+       <spacer name="horizontalSpacer_4">
109
+        <property name="orientation">
110
+         <enum>Qt::Horizontal</enum>
111
+        </property>
112
+        <property name="sizeHint" stdset="0">
113
+         <size>
114
+          <width>40</width>
115
+          <height>20</height>
116
+         </size>
117
+        </property>
118
+       </spacer>
119
+      </item>
120
+      <item>
121
+       <widget class="QLabel" name="labelStatus">
122
+        <property name="text">
123
+         <string>idle</string>
124
+        </property>
125
+       </widget>
126
+      </item>
127
+      <item>
128
+       <spacer name="horizontalSpacer_3">
129
+        <property name="orientation">
130
+         <enum>Qt::Horizontal</enum>
131
+        </property>
132
+        <property name="sizeHint" stdset="0">
133
+         <size>
134
+          <width>40</width>
135
+          <height>20</height>
136
+         </size>
137
+        </property>
138
+       </spacer>
139
+      </item>
140
+     </layout>
141
+    </widget>
142
+   </item>
143
+   <item>
144
+    <layout class="QHBoxLayout" name="horizontalLayout">
145
+     <item>
146
+      <layout class="QVBoxLayout" name="verticalLayout_2">
147
+       <property name="sizeConstraint">
148
+        <enum>QLayout::SetDefaultConstraint</enum>
149
+       </property>
150
+       <item>
151
+        <widget class="QLabel" name="label">
152
+         <property name="text">
153
+          <string>Last name:</string>
154
+         </property>
155
+        </widget>
156
+       </item>
157
+       <item>
158
+        <widget class="QLineEdit" name="lineLastName"/>
159
+       </item>
160
+      </layout>
161
+     </item>
162
+     <item>
163
+      <layout class="QVBoxLayout" name="verticalLayout_5">
164
+       <item>
165
+        <widget class="QLabel" name="label_2">
166
+         <property name="text">
167
+          <string>First name:</string>
168
+         </property>
169
+        </widget>
170
+       </item>
171
+       <item>
172
+        <widget class="QLineEdit" name="lineFirstName"/>
173
+       </item>
174
+      </layout>
175
+     </item>
176
+     <item>
177
+      <layout class="QVBoxLayout" name="verticalLayout_8">
178
+       <item>
179
+        <widget class="QLabel" name="label_3">
180
+         <property name="text">
181
+          <string>Login:</string>
182
+         </property>
183
+        </widget>
184
+       </item>
185
+       <item>
186
+        <widget class="QLineEdit" name="lineLogin"/>
187
+       </item>
188
+      </layout>
189
+     </item>
190
+     <item>
191
+      <layout class="QVBoxLayout" name="verticalLayout_11">
192
+       <item>
193
+        <widget class="QLabel" name="label_4">
194
+         <property name="text">
195
+          <string>Promo:</string>
196
+         </property>
197
+        </widget>
198
+       </item>
199
+       <item>
200
+        <widget class="QLineEdit" name="linePromo"/>
201
+       </item>
202
+      </layout>
203
+     </item>
204
+     <item>
205
+      <layout class="QVBoxLayout" name="verticalLayout_17">
206
+       <item>
207
+        <widget class="QLabel" name="label_6">
208
+         <property name="text">
209
+          <string>School:</string>
210
+         </property>
211
+        </widget>
212
+       </item>
213
+       <item>
214
+        <widget class="QLineEdit" name="lineSchool"/>
215
+       </item>
216
+      </layout>
217
+     </item>
218
+     <item>
219
+      <layout class="QVBoxLayout" name="verticalLayout_14">
220
+       <item>
221
+        <widget class="QLabel" name="label_5">
222
+         <property name="text">
223
+          <string>City:</string>
224
+         </property>
225
+        </widget>
226
+       </item>
227
+       <item>
228
+        <widget class="QComboBox" name="comboBox">
229
+         <property name="minimumSize">
230
+          <size>
231
+           <width>80</width>
232
+           <height>20</height>
233
+          </size>
234
+         </property>
235
+         <property name="styleSheet">
236
+          <string notr="true">QWidget{
237
+background-color: black;
238
+border: 1px;
239
+	color: rgb(255, 255, 255);
240
+}</string>
241
+         </property>
242
+         <property name="editable">
243
+          <bool>false</bool>
244
+         </property>
245
+         <property name="currentIndex">
246
+          <number>-1</number>
247
+         </property>
248
+         <property name="sizeAdjustPolicy">
249
+          <enum>QComboBox::AdjustToContents</enum>
250
+         </property>
251
+        </widget>
252
+       </item>
253
+      </layout>
254
+     </item>
255
+    </layout>
256
+   </item>
257
+   <item>
258
+    <widget class="Line" name="line">
259
+     <property name="frameShadow">
260
+      <enum>QFrame::Plain</enum>
261
+     </property>
262
+     <property name="orientation">
263
+      <enum>Qt::Horizontal</enum>
264
+     </property>
265
+    </widget>
266
+   </item>
267
+   <item>
268
+    <layout class="QGridLayout" name="gridLayout"/>
269
+   </item>
270
+   <item>
271
+    <spacer name="verticalSpacer">
272
+     <property name="orientation">
273
+      <enum>Qt::Vertical</enum>
274
+     </property>
275
+     <property name="sizeHint" stdset="0">
276
+      <size>
277
+       <width>20</width>
278
+       <height>40</height>
279
+      </size>
280
+     </property>
281
+    </spacer>
282
+   </item>
283
+  </layout>
284
+ </widget>
285
+ <layoutdefault spacing="6" margin="11"/>
286
+ <resources>
287
+  <include location="../Epimafia/rc.qrc"/>
288
+ </resources>
289
+ <connections/>
290
+</ui>

+ 58
- 0
netsoul/chatmanager.cpp Ver arquivo

@@ -0,0 +1,58 @@
1
+#include "chatmanager.h"
2
+
3
+ChatManager::ChatManager(QObject *parent) : QObject(parent)
4
+{
5
+}
6
+
7
+ChatManager::~ChatManager()
8
+{
9
+	qDeleteAll(m_dlgChat);
10
+}
11
+
12
+void ChatManager::chat(NetSoul::Users users)
13
+{
14
+	foreach(NetSoul::User user, users)
15
+	{
16
+		DialogChat* ch = getChatWindow(user);
17
+		ch->show();
18
+		ch->raise();
19
+	}
20
+}
21
+
22
+void ChatManager::newMessage(NetSoul::Message msg)
23
+{
24
+	DialogChat* ch = getChatWindow(msg.from);
25
+	ch->newMessage(msg);
26
+	if(!ch->isVisible())
27
+		ch->showMinimized();
28
+	if(!ch->isActiveWindow())
29
+		QApplication::alert(ch);
30
+}
31
+
32
+void ChatManager::setMe(NetSoul::User user)
33
+{
34
+	if(user.login != m_me.login)
35
+	{
36
+		qDeleteAll(m_dlgChat);
37
+		m_dlgChat.clear();
38
+	}
39
+	m_me = user;
40
+}
41
+
42
+void ChatManager::dlgChatsendMessage(NetSoul::User usr, QString msg)
43
+{
44
+	emit sendMessageRequested(usr, msg);
45
+}
46
+
47
+DialogChat*ChatManager::getChatWindow(NetSoul::User user)
48
+{
49
+	foreach(DialogChat* ch, m_dlgChat)
50
+		if(ch->match(user))
51
+			return ch;
52
+	DialogChat* ch = new DialogChat();
53
+	connect(ch, SIGNAL(sendMessageRequested(NetSoul::User,QString)), this, SLOT(dlgChatsendMessage(NetSoul::User,QString)));
54
+	m_dlgChat.append(ch);
55
+	ch->setUser(user);
56
+	ch->setMe(m_me);
57
+	return ch;
58
+}

+ 33
- 0
netsoul/chatmanager.h Ver arquivo

@@ -0,0 +1,33 @@
1
+#ifndef CHATMANAGER_H
2
+#define CHATMANAGER_H
3
+
4
+#include <QObject>
5
+#include <QApplication>
6
+#include "netsoul.h"
7
+#include "dialogchat.h"
8
+
9
+class ChatManager : public QObject
10
+{
11
+	Q_OBJECT
12
+public:
13
+	explicit ChatManager(QObject *parent = 0);
14
+	~ChatManager();
15
+	
16
+signals:
17
+	void sendMessageRequested(NetSoul::User, QString);
18
+
19
+public slots:
20
+	void chat(NetSoul::Users users);
21
+	void newMessage(NetSoul::Message msg);
22
+	void setMe(NetSoul::User user);
23
+
24
+private slots:
25
+	void dlgChatsendMessage(NetSoul::User usr, QString msg);
26
+
27
+private:
28
+	DialogChat* getChatWindow(NetSoul::User user);
29
+	QList<DialogChat*> m_dlgChat;
30
+	NetSoul::User m_me;
31
+};
32
+
33
+#endif // CHATMANAGER_H

+ 81
- 0
netsoul/connectwidget.cpp Ver arquivo

@@ -0,0 +1,81 @@
1
+#include "connectwidget.h"
2
+#include "ui_connectwidget.h"
3
+
4
+ConnectWidget::ConnectWidget(QWidget *parent) : QWidget(parent), ui(new Ui::ConnectWidget)
5
+{
6
+    ui->setupUi(this);
7
+    connect(ui->btnConnect, SIGNAL(clicked()), this, SLOT(login()));
8
+    connect(ui->btnManage, SIGNAL(clicked()), this, SLOT(launchUsrManager()));
9
+    connect(ui->btnReload, SIGNAL(clicked()), this, SLOT(loadUsers()));
10
+    loadUsers();
11
+    if(ui->lineLogin->count() == 0)
12
+    {
13
+        QMessageBox* msg = new QMessageBox(this);
14
+        msg->setIcon(QMessageBox::Question);
15
+        msg->setWindowTitle("No logins available");
16
+        msg->setText("No logins with socks are available.\nDo you want to open User Manager to create one?");
17
+        connect(msg->addButton(QMessageBox::Yes), SIGNAL(clicked()), this, SLOT(launchUsrManager()));
18
+        connect(msg->addButton(QMessageBox::No), SIGNAL(clicked()), this, SLOT(loadUsers()));
19
+        msg->show();
20
+    }
21
+}
22
+
23
+ConnectWidget::~ConnectWidget()
24
+{
25
+	delete ui;
26
+}
27
+
28
+bool ConnectWidget::hasLogin(QString login)
29
+{
30
+	for(int i = 0; i < ui->lineLogin->count(); ++i)
31
+		if(ui->lineLogin->itemText(i) == login)
32
+			return true;
33
+	return false;
34
+}
35
+
36
+void ConnectWidget::nsStateChanged(NetSoul::State s)
37
+{
38
+    ui->btnConnect->setEnabled(s == NetSoul::Disconnected || s == NetSoul::ProtocolError || s == NetSoul::NetworkError || s == NetSoul::BadLogin);
39
+    ui->lineLogin->setEnabled(ui->btnConnect->isEnabled());
40
+}
41
+
42
+void ConnectWidget::login()
43
+{
44
+	if(ui->lineLogin->count() > 0)
45
+		emit loginRequested(qvariant_cast<EpiUser>(ui->lineLogin->itemData(ui->lineLogin->currentIndex())));
46
+}
47
+
48
+void ConnectWidget::loadUsers()
49
+{
50
+    ui->lineLogin->clear();
51
+    EpiUsers users = Epimafia::loadUsers();
52
+    foreach(EpiUser user, users)
53
+        if(!user.isUnknown() && user.hasLogin() && user.hasPwd_socks())
54
+            ui->lineLogin->addItem(user.getLogin(), user.toVariant());
55
+
56
+	QString login = Options::instance()->getDefaultLogin();
57
+	for(int i = 0; i < ui->lineLogin->count(); ++i)
58
+		if(ui->lineLogin->itemText(i) == login)
59
+		{
60
+			ui->lineLogin->setCurrentIndex(i);
61
+			return;
62
+		}
63
+}
64
+
65
+void ConnectWidget::launchUsrManager()
66
+{
67
+    QProcess* p = new QProcess(this);
68
+    connect(p, SIGNAL(finished(int)), this, SLOT(processFinished(int)));
69
+	QString exe;
70
+#ifdef Q_OS_WIN
71
+	exe = "usermgr.exe";
72
+#else
73
+#error "OS specific"
74
+#endif
75
+	p->start(exe);
76
+}
77
+
78
+void ConnectWidget::processFinished(int)
79
+{
80
+    loadUsers();
81
+}

+ 41
- 0
netsoul/connectwidget.h Ver arquivo

@@ -0,0 +1,41 @@
1
+#ifndef CONNECTWIDGET_H
2
+#define CONNECTWIDGET_H
3
+
4
+#include <QWidget>
5
+#include <QMessageBox>
6
+#include <QProcess>
7
+#include "options.h"
8
+#include "netsoul.h"
9
+#include "epimafia.h"
10
+
11
+namespace Ui {
12
+class ConnectWidget;
13
+}
14
+
15
+class ConnectWidget : public QWidget
16
+{
17
+    Q_OBJECT
18
+    
19
+public:
20
+    explicit ConnectWidget(QWidget *parent = 0);
21
+    ~ConnectWidget();
22
+
23
+	bool hasLogin(QString login);
24
+
25
+signals:
26
+    void loginRequested(EpiUser);
27
+
28
+public slots:
29
+    void nsStateChanged(NetSoul::State s);
30
+    void login();
31
+    void loadUsers();
32
+    void launchUsrManager();
33
+
34
+private slots:
35
+    void processFinished(int);
36
+
37
+private:
38
+    Ui::ConnectWidget *ui;
39
+};
40
+
41
+#endif // CONNECTWIDGET_H

+ 317
- 0
netsoul/connectwidget.ui Ver arquivo

@@ -0,0 +1,317 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<ui version="4.0">
3
+ <class>ConnectWidget</class>
4
+ <widget class="QWidget" name="ConnectWidget">
5
+  <property name="geometry">
6
+   <rect>
7
+    <x>0</x>
8
+    <y>0</y>
9
+    <width>201</width>
10
+    <height>296</height>
11
+   </rect>
12
+  </property>
13
+  <property name="windowTitle">
14
+   <string>Form</string>
15
+  </property>
16
+  <property name="styleSheet">
17
+   <string notr="true">QWidget
18
+{
19
+background-color: rgb(0, 0, 0);
20
+color: rgb(255, 255, 255);
21
+}
22
+QPushButton
23
+{
24
+border: 1px solid white;
25
+border-radius: 4px;
26
+height: 20px;
27
+min-width: 50px;
28
+}
29
+QPushButton:hover
30
+{
31
+	background-color:rgb(71, 71, 71);
32
+}
33
+QPushButton:pressed
34
+{
35
+	background-color:rgb(42, 42, 42);
36
+}
37
+QFrame, QToolTip
38
+{
39
+color: black;
40
+}
41
+QLabel
42
+{
43
+color: white;
44
+}</string>
45
+  </property>
46
+  <layout class="QVBoxLayout" name="verticalLayout_2">
47
+   <item>
48
+    <spacer name="verticalSpacer">
49
+     <property name="orientation">
50
+      <enum>Qt::Vertical</enum>
51
+     </property>
52
+     <property name="sizeHint" stdset="0">
53
+      <size>
54
+       <width>20</width>
55
+       <height>40</height>
56
+      </size>
57
+     </property>
58
+    </spacer>
59
+   </item>
60
+   <item>
61
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
62
+     <item>
63
+      <spacer name="horizontalSpacer_4">
64
+       <property name="orientation">
65
+        <enum>Qt::Horizontal</enum>
66
+       </property>
67
+       <property name="sizeHint" stdset="0">
68
+        <size>
69
+         <width>40</width>
70
+         <height>20</height>
71
+        </size>
72
+       </property>
73
+      </spacer>
74
+     </item>
75
+     <item>
76
+      <widget class="QLabel" name="labelLogin">
77
+       <property name="text">
78
+        <string>Login:</string>
79
+       </property>
80
+      </widget>
81
+     </item>
82
+     <item>
83
+      <spacer name="horizontalSpacer_3">
84
+       <property name="orientation">
85
+        <enum>Qt::Horizontal</enum>
86
+       </property>
87
+       <property name="sizeHint" stdset="0">
88
+        <size>
89
+         <width>40</width>
90
+         <height>20</height>
91
+        </size>
92
+       </property>
93
+      </spacer>
94
+     </item>
95
+    </layout>
96
+   </item>
97
+   <item>
98
+    <layout class="QHBoxLayout" name="horizontalLayout_3">
99
+     <item>
100
+      <spacer name="horizontalSpacer_5">
101
+       <property name="orientation">
102
+        <enum>Qt::Horizontal</enum>
103
+       </property>
104
+       <property name="sizeHint" stdset="0">
105
+        <size>
106
+         <width>40</width>
107
+         <height>20</height>
108
+        </size>
109
+       </property>
110
+      </spacer>
111
+     </item>
112
+     <item>
113
+      <widget class="QComboBox" name="lineLogin">
114
+       <property name="sizePolicy">
115
+        <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
116
+         <horstretch>0</horstretch>
117
+         <verstretch>0</verstretch>
118
+        </sizepolicy>
119
+       </property>
120
+       <property name="minimumSize">
121
+        <size>
122
+         <width>80</width>
123
+         <height>20</height>
124
+        </size>
125
+       </property>
126
+       <property name="styleSheet">
127
+        <string notr="true">QWidget
128
+{
129
+border: 1px solid white;
130
+border-radius: 1px;
131
+}
132
+QFrame, QToolTip
133
+{
134
+color: white;
135
+}</string>
136
+       </property>
137
+      </widget>
138
+     </item>
139
+     <item>
140
+      <spacer name="horizontalSpacer_6">
141
+       <property name="orientation">
142
+        <enum>Qt::Horizontal</enum>
143
+       </property>
144
+       <property name="sizeHint" stdset="0">
145
+        <size>
146
+         <width>40</width>
147
+         <height>20</height>
148
+        </size>
149
+       </property>
150
+      </spacer>
151
+     </item>
152
+    </layout>
153
+   </item>
154
+   <item>
155
+    <layout class="QHBoxLayout" name="horizontalLayout_4">
156
+     <item>
157
+      <spacer name="horizontalSpacer_7">
158
+       <property name="orientation">
159
+        <enum>Qt::Horizontal</enum>
160
+       </property>
161
+       <property name="sizeHint" stdset="0">
162
+        <size>
163
+         <width>40</width>
164
+         <height>20</height>
165
+        </size>
166
+       </property>
167
+      </spacer>
168
+     </item>
169
+     <item>
170
+      <widget class="QPushButton" name="btnReload">
171
+       <property name="text">
172
+        <string>Reload</string>
173
+       </property>
174
+      </widget>
175
+     </item>
176
+     <item>
177
+      <widget class="QPushButton" name="btnManage">
178
+       <property name="text">
179
+        <string>Manage</string>
180
+       </property>
181
+      </widget>
182
+     </item>
183
+     <item>
184
+      <spacer name="horizontalSpacer_8">
185
+       <property name="orientation">
186
+        <enum>Qt::Horizontal</enum>
187
+       </property>
188
+       <property name="sizeHint" stdset="0">
189
+        <size>
190
+         <width>40</width>
191
+         <height>20</height>
192
+        </size>
193
+       </property>
194
+      </spacer>
195
+     </item>
196
+    </layout>
197
+   </item>
198
+   <item>
199
+    <spacer name="verticalSpacer_3">
200
+     <property name="orientation">
201
+      <enum>Qt::Vertical</enum>
202
+     </property>
203
+     <property name="sizeHint" stdset="0">
204
+      <size>
205
+       <width>20</width>
206
+       <height>40</height>
207
+      </size>
208
+     </property>
209
+    </spacer>
210
+   </item>
211
+   <item>
212
+    <layout class="QHBoxLayout" name="horizontalLayout">
213
+     <item>
214
+      <spacer name="horizontalSpacer_2">
215
+       <property name="orientation">
216
+        <enum>Qt::Horizontal</enum>
217
+       </property>
218
+       <property name="sizeHint" stdset="0">
219
+        <size>
220
+         <width>40</width>
221
+         <height>20</height>
222
+        </size>
223
+       </property>
224
+      </spacer>
225
+     </item>
226
+     <item>
227
+      <widget class="QPushButton" name="btnConnect">
228
+       <property name="sizePolicy">
229
+        <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
230
+         <horstretch>0</horstretch>
231
+         <verstretch>0</verstretch>
232
+        </sizepolicy>
233
+       </property>
234
+       <property name="minimumSize">
235
+        <size>
236
+         <width>52</width>
237
+         <height>56</height>
238
+        </size>
239
+       </property>
240
+       <property name="maximumSize">
241
+        <size>
242
+         <width>56</width>
243
+         <height>56</height>
244
+        </size>
245
+       </property>
246
+       <property name="toolTip">
247
+        <string>Connect</string>
248
+       </property>
249
+       <property name="styleSheet">
250
+        <string notr="true">QPushButton
251
+{
252
+border: 1px solid white;
253
+border-radius: 5px;
254
+}
255
+QPushButton:hover
256
+{
257
+	background-color:rgb(71, 71, 71);
258
+}
259
+QPushButton:pressed
260
+{
261
+	background-color:rgb(42, 42, 42);
262
+}
263
+QFrame, QToolTip
264
+{
265
+color: black;
266
+}</string>
267
+       </property>
268
+       <property name="text">
269
+        <string/>
270
+       </property>
271
+       <property name="icon">
272
+        <iconset resource="../Epimafia/rc.qrc">
273
+         <normaloff>:/epimafia/icon.png</normaloff>:/epimafia/icon.png</iconset>
274
+       </property>
275
+       <property name="iconSize">
276
+        <size>
277
+         <width>56</width>
278
+         <height>56</height>
279
+        </size>
280
+       </property>
281
+      </widget>
282
+     </item>
283
+     <item>
284
+      <spacer name="horizontalSpacer">
285
+       <property name="orientation">
286
+        <enum>Qt::Horizontal</enum>
287
+       </property>
288
+       <property name="sizeHint" stdset="0">
289
+        <size>
290
+         <width>37</width>
291
+         <height>53</height>
292
+        </size>
293
+       </property>
294
+      </spacer>
295
+     </item>
296
+    </layout>
297
+   </item>
298
+   <item>
299
+    <spacer name="verticalSpacer_2">
300
+     <property name="orientation">
301
+      <enum>Qt::Vertical</enum>
302
+     </property>
303
+     <property name="sizeHint" stdset="0">
304
+      <size>
305
+       <width>20</width>
306
+       <height>40</height>
307
+      </size>
308
+     </property>
309
+    </spacer>
310
+   </item>
311
+  </layout>
312
+ </widget>
313
+ <resources>
314
+  <include location="../Epimafia/rc.qrc"/>
315
+ </resources>
316
+ <connections/>
317
+</ui>

+ 107
- 0
netsoul/contactswidget.cpp Ver arquivo

@@ -0,0 +1,107 @@
1
+#include "contactswidget.h"
2
+#include "ui_contactswidget.h"
3
+
4
+ContactsWidget::ContactsWidget(QWidget *parent) : QWidget(parent), ui(new Ui::ContactsWidget)
5
+{
6
+    ui->setupUi(this);
7
+
8
+    ui->comboUserState->addItem(NetSoul::getStringFromUserState(NetSoul::Actif), NetSoul::Actif);
9
+    ui->comboUserState->addItem(NetSoul::getStringFromUserState(NetSoul::Away), NetSoul::Away);
10
+    ui->comboUserState->addItem(NetSoul::getStringFromUserState(NetSoul::Lock), NetSoul::Lock);
11
+
12
+    connect(ui->listContacts, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contactsMenuRequested(QPoint)));
13
+    connect(ui->listContacts, SIGNAL(userSelected(NetSoul::User)), this, SLOT(chatWithContact(NetSoul::User)));
14
+
15
+    for(int i = 0; i < ui->listContacts->header()->count(); ++i)
16
+        ui->listContacts->header()->resizeSection(i, 80);
17
+
18
+    m_contactsMenu = new QMenu("Contacts");
19
+    connect(m_contactsMenu->addAction("Chat"), SIGNAL(triggered()), this, SLOT(chat()));
20
+    connect(m_contactsMenu->addAction("Search on intra-bocal"), SIGNAL(triggered()), this, SLOT(searchOnIntra()));
21
+    connect(m_contactsMenu->addAction("Delete"), SIGNAL(triggered()), this, SLOT(removeFromContacts()));
22
+}
23
+
24
+ContactsWidget::~ContactsWidget()
25
+{
26
+    delete ui;
27
+    delete m_contactsMenu;
28
+}
29
+
30
+void ContactsWidget::nsStateChanged(NetSoul::State s)
31
+{
32
+	if(s == NetSoul::Disconnected || s == NetSoul::NetworkError || s == NetSoul::ProtocolError)
33
+        ui->listContacts->clear();
34
+}
35
+
36
+void ContactsWidget::nsUserDataChanged(NetSoul::User user)
37
+{
38
+    ui->listContacts->updateUser(user);
39
+}
40
+
41
+void ContactsWidget::addContact(QString contact)
42
+{
43
+    NetSoul::User usr;
44
+    usr.login = contact;
45
+    ui->listContacts->addUser(usr);
46
+}
47
+
48
+void ContactsWidget::addContacts(QStringList contacts)
49
+{
50
+    foreach(QString contact, contacts)
51
+        addContact(contact);
52
+}
53
+
54
+void ContactsWidget::removeFromContacts(QString login)
55
+{
56
+    removeFromContacts(QStringList() << login);
57
+}
58
+
59
+void ContactsWidget::removeFromContacts(QStringList logins)
60
+{
61
+    ui->listContacts->remove(logins);
62
+}
63
+
64
+void ContactsWidget::on_comboUserState_activated(int index)
65
+{
66
+    emit userStateChanged((NetSoul::UserState)ui->comboUserState->itemData(index).toInt());
67
+}
68
+
69
+void ContactsWidget::contactsMenuRequested(QPoint p)
70
+{
71
+    if(ui->listContacts->getSelectedUsers().isEmpty())
72
+        return;
73
+    m_contactsMenu->move(ui->listContacts->mapToGlobal(p) + QPoint(0, ui->listContacts->header()->height()));
74
+    m_contactsMenu->show();
75
+}
76
+
77
+void ContactsWidget::chat()
78
+{
79
+    emit chatRequested(ui->listContacts->getSelectedUsers());
80
+}
81
+
82
+void ContactsWidget::searchOnIntra()
83
+{
84
+	QString exe;
85
+#ifdef Q_OS_WIN
86
+	exe = "intrabocal.exe";
87
+#else
88
+#error "OS specific"
89
+#endif
90
+    foreach(NetSoul::User usr, ui->listContacts->getSelectedUsers())
91
+		QProcess::startDetached(exe, QStringList() << "-login" << usr.login);
92
+}
93
+
94
+void ContactsWidget::removeFromContacts()
95
+{
96
+    QStringList logins;
97
+    foreach(NetSoul::User usr, ui->listContacts->getSelectedUsers())
98
+        if(!logins.contains(usr.login))
99
+            logins.append(usr.login);
100
+    if(!logins.isEmpty())
101
+        emit removeFromContactsRequested(logins);
102
+}
103
+
104
+void ContactsWidget::chatWithContact(NetSoul::User user)
105
+{
106
+    emit chatRequested(NetSoul::Users() << user);
107
+}

+ 48
- 0
netsoul/contactswidget.h Ver arquivo

@@ -0,0 +1,48 @@
1
+#ifndef CONTACTSWIDGET_H
2
+#define CONTACTSWIDGET_H
3
+
4
+#include <QWidget>
5
+#include <QStringList>
6
+#include <QMenu>
7
+#include <QProcess>
8
+#include "netsoul.h"
9
+
10
+namespace Ui {
11
+class ContactsWidget;
12
+}
13
+
14
+class ContactsWidget : public QWidget
15
+{
16
+    Q_OBJECT
17
+    
18
+public:
19
+    explicit ContactsWidget(QWidget *parent = 0);
20
+    ~ContactsWidget();
21
+
22
+signals:
23
+    void userStateChanged(NetSoul::UserState);
24
+    void removeFromContactsRequested(QStringList logins);
25
+    void chatRequested(NetSoul::Users);
26
+
27
+public slots:
28
+    void nsStateChanged(NetSoul::State s);
29
+    void nsUserDataChanged(NetSoul::User user);
30
+    void addContact(QString contact);
31
+    void addContacts(QStringList contacts);
32
+    void removeFromContacts(QString login);
33
+    void removeFromContacts(QStringList logins);
34
+    
35
+private slots:
36
+    void on_comboUserState_activated(int index);
37
+    void contactsMenuRequested(QPoint p);
38
+    void chat();
39
+    void searchOnIntra();
40
+    void removeFromContacts();
41
+    void chatWithContact(NetSoul::User user);
42
+
43
+private:
44
+    Ui::ContactsWidget *ui;
45
+    QMenu* m_contactsMenu;
46
+};
47
+
48
+#endif // CONTACTSWIDGET_H

+ 73
- 0
netsoul/contactswidget.ui Ver arquivo

@@ -0,0 +1,73 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<ui version="4.0">
3
+ <class>ContactsWidget</class>
4
+ <widget class="QWidget" name="ContactsWidget">
5
+  <property name="geometry">
6
+   <rect>
7
+    <x>0</x>
8
+    <y>0</y>
9
+    <width>246</width>
10
+    <height>282</height>
11
+   </rect>
12
+  </property>
13
+  <property name="windowTitle">
14
+   <string>Form</string>
15
+  </property>
16
+  <property name="styleSheet">
17
+   <string notr="true">color: rgb(255, 255, 255);
18
+background-color: rgb(0, 0, 0);</string>
19
+  </property>
20
+  <layout class="QGridLayout" name="gridLayout">
21
+   <property name="margin">
22
+    <number>0</number>
23
+   </property>
24
+   <item row="0" column="1">
25
+    <widget class="QComboBox" name="comboUserState">
26
+     <property name="minimumSize">
27
+      <size>
28
+       <width>60</width>
29
+       <height>0</height>
30
+      </size>
31
+     </property>
32
+     <property name="maximumSize">
33
+      <size>
34
+       <width>60</width>
35
+       <height>16777215</height>
36
+      </size>
37
+     </property>
38
+     <property name="styleSheet">
39
+      <string notr="true">border: 1px;</string>
40
+     </property>
41
+     <property name="sizeAdjustPolicy">
42
+      <enum>QComboBox::AdjustToMinimumContentsLength</enum>
43
+     </property>
44
+    </widget>
45
+   </item>
46
+   <item row="0" column="0">
47
+    <spacer name="horizontalSpacer">
48
+     <property name="orientation">
49
+      <enum>Qt::Horizontal</enum>
50
+     </property>
51
+     <property name="sizeHint" stdset="0">
52
+      <size>
53
+       <width>177</width>
54
+       <height>20</height>
55
+      </size>
56
+     </property>
57
+    </spacer>
58
+   </item>
59
+   <item row="1" column="0" colspan="2">
60
+    <widget class="UserTreeWidget" name="listContacts"/>
61
+   </item>
62
+  </layout>
63
+ </widget>
64
+ <customwidgets>
65
+  <customwidget>
66
+   <class>UserTreeWidget</class>
67
+   <extends>QTreeWidget</extends>
68
+   <header>usertreewidget.h</header>
69
+  </customwidget>
70
+ </customwidgets>
71
+ <resources/>
72
+ <connections/>
73
+</ui>

+ 53
- 0
netsoul/dialogaddcontact.cpp Ver arquivo

@@ -0,0 +1,53 @@
1
+#include "dialogaddcontact.h"
2
+#include "ui_dialogaddcontact.h"
3
+
4
+DialogAddContact::DialogAddContact(QWidget *parent) : QDialog(parent), ui(new Ui::DialogAddContact)
5
+{
6
+    ui->setupUi(this);
7
+    connect(ui->lineSearch, SIGNAL(textChanged(QString)), ui->listContacts, SLOT(filter(QString)));
8
+    connect(ui->listContacts, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(menuRequested(QPoint)));
9
+    m_menu = new QMenu("Add contact");
10
+    connect(m_menu->addAction("Add to contacts"), SIGNAL(triggered()), this, SLOT(addContact()));
11
+    connect(m_menu->addAction("Chat"), SIGNAL(triggered()), this, SLOT(chat()));
12
+}
13
+
14
+DialogAddContact::~DialogAddContact()
15
+{
16
+    delete ui;
17
+    delete m_menu;
18
+}
19
+
20
+void DialogAddContact::setUsers(NetSoul::Users users)
21
+{
22
+    ui->listContacts->clear();
23
+    ui->listContacts->addUsers(users);
24
+}
25
+
26
+void DialogAddContact::on_lineSearch_returnPressed()
27
+{
28
+    emit contactAdded(ui->lineSearch->text());
29
+}
30
+
31
+void DialogAddContact::on_listContacts_itemDoubleClicked(QTreeWidgetItem *item, int column)
32
+{
33
+    emit contactAdded(item->text(0));
34
+}
35
+
36
+void DialogAddContact::chat()
37
+{
38
+    emit chatRequested(ui->listContacts->getSelectedUsers());
39
+}
40
+
41
+void DialogAddContact::addContact()
42
+{
43
+    foreach(NetSoul::User usr, ui->listContacts->getSelectedUsers())
44
+        emit contactAdded(usr.login);
45
+}
46
+
47
+void DialogAddContact::menuRequested(QPoint p)
48
+{
49
+    if(ui->listContacts->getSelectedUsers().isEmpty())
50
+        return;
51
+    m_menu->move(ui->listContacts->mapToGlobal(p) + QPoint(0, ui->listContacts->header()->height()));
52
+    m_menu->show();
53
+}

+ 40
- 0
netsoul/dialogaddcontact.h Ver arquivo

@@ -0,0 +1,40 @@
1
+#ifndef DIALOGADDCONTACT_H
2
+#define DIALOGADDCONTACT_H
3
+
4
+#include <QDialog>
5
+#include <QTreeWidgetItem>
6
+#include <QMenu>
7
+#include "netsoul.h"
8
+
9
+namespace Ui {
10
+class DialogAddContact;
11
+}
12
+
13
+class DialogAddContact : public QDialog
14
+{
15
+    Q_OBJECT
16
+    
17
+public:
18
+    explicit DialogAddContact(QWidget *parent = 0);
19
+    ~DialogAddContact();
20
+
21
+public slots:
22
+    void setUsers(NetSoul::Users users);
23
+    
24
+signals:
25
+    void contactAdded(QString);
26
+    void chatRequested(NetSoul::Users);
27
+
28
+private slots:
29
+    void on_lineSearch_returnPressed();
30
+    void on_listContacts_itemDoubleClicked(QTreeWidgetItem *item, int column);
31
+    void chat();
32
+    void addContact();
33
+    void menuRequested(QPoint p);
34
+
35
+private:
36
+    Ui::DialogAddContact *ui;
37
+    QMenu* m_menu;
38
+};
39
+
40
+#endif // DIALOGADDCONTACT_H

+ 48
- 0
netsoul/dialogaddcontact.ui Ver arquivo

@@ -0,0 +1,48 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<ui version="4.0">
3
+ <class>DialogAddContact</class>
4
+ <widget class="QDialog" name="DialogAddContact">
5
+  <property name="geometry">
6
+   <rect>
7
+    <x>0</x>
8
+    <y>0</y>
9
+    <width>400</width>
10
+    <height>300</height>
11
+   </rect>
12
+  </property>
13
+  <property name="windowTitle">
14
+   <string>Add Contact - Epimafia</string>
15
+  </property>
16
+  <property name="styleSheet">
17
+   <string notr="true">color: rgb(255, 255, 255);
18
+background-color: rgb(0, 0, 0);</string>
19
+  </property>
20
+  <property name="modal">
21
+   <bool>true</bool>
22
+  </property>
23
+  <layout class="QGridLayout" name="gridLayout">
24
+   <item row="0" column="0">
25
+    <widget class="QLabel" name="label">
26
+     <property name="text">
27
+      <string>Login:</string>
28
+     </property>
29
+    </widget>
30
+   </item>
31
+   <item row="0" column="1">
32
+    <widget class="QLineEdit" name="lineSearch"/>
33
+   </item>
34
+   <item row="1" column="0" colspan="2">
35
+    <widget class="UserTreeWidget" name="listContacts"/>
36
+   </item>
37
+  </layout>
38
+ </widget>
39
+ <customwidgets>
40
+  <customwidget>
41
+   <class>UserTreeWidget</class>
42
+   <extends>QTreeWidget</extends>
43
+   <header>usertreewidget.h</header>
44
+  </customwidget>
45
+ </customwidgets>
46
+ <resources/>
47
+ <connections/>
48
+</ui>

+ 56
- 0
netsoul/dialogchat.cpp Ver arquivo

@@ -0,0 +1,56 @@
1
+#include "dialogchat.h"
2
+#include "ui_dialogchat.h"
3
+
4
+DialogChat::DialogChat(QWidget *parent) : QWidget(parent), ui(new Ui::DialogChat)
5
+{
6
+	ui->setupUi(this);
7
+}
8
+
9
+DialogChat::~DialogChat()
10
+{
11
+	delete ui;
12
+}
13
+
14
+NetSoul::User DialogChat::getUser()
15
+{
16
+	return m_user;
17
+}
18
+
19
+bool DialogChat::match(NetSoul::User usr)
20
+{
21
+	return usr.login == m_user.login && usr.location == m_user.location;
22
+}
23
+
24
+void DialogChat::closeEvent(QCloseEvent* e)
25
+{
26
+	e->ignore();
27
+	hide();
28
+}
29
+
30
+void DialogChat::setUser(NetSoul::User user)
31
+{
32
+	m_user = user;
33
+	setWindowTitle(user.login + "@" + user.location);
34
+}
35
+
36
+void DialogChat::newMessage(NetSoul::Message msg)
37
+{
38
+	append(msg.from, msg.message);
39
+}
40
+
41
+void DialogChat::setMe(NetSoul::User usr)
42
+{
43
+	m_me = usr;
44
+}
45
+
46
+void DialogChat::on_lineChat_returnPressed()
47
+{
48
+	emit sendMessageRequested(m_user, ui->lineChat->text());
49
+	append(m_me, ui->lineChat->text());
50
+	ui->lineChat->clear();
51
+}
52
+
53
+void DialogChat::append(NetSoul::User usr, QString msg)
54
+{
55
+	ui->textChat->append(usr.login + "@" + usr.location + ": " + msg);
56
+}

+ 43
- 0
netsoul/dialogchat.h Ver arquivo

@@ -0,0 +1,43 @@
1
+#ifndef DIALOGCHAT_H
2
+#define DIALOGCHAT_H
3
+
4
+#include <QCloseEvent>
5
+#include <QDialog>
6
+#include "netsoul.h"
7
+
8
+namespace Ui {
9
+class DialogChat;
10
+}
11
+
12
+class DialogChat : public QWidget
13
+{
14
+	Q_OBJECT
15
+	
16
+public:
17
+	explicit DialogChat(QWidget *parent = 0);
18
+	~DialogChat();
19
+	NetSoul::User getUser();
20
+	bool match(NetSoul::User usr);
21
+
22
+signals:
23
+	void sendMessageRequested(NetSoul::User, QString);
24
+
25
+protected:
26
+	void closeEvent(QCloseEvent *e);
27
+
28
+public slots:
29
+	void setUser(NetSoul::User user);
30
+	void newMessage(NetSoul::Message msg);
31
+	void setMe(NetSoul::User usr);
32
+	
33
+private slots:
34
+	void on_lineChat_returnPressed();
35
+	void append(NetSoul::User usr, QString msg);
36
+
37
+private:
38
+	Ui::DialogChat *ui;
39
+	NetSoul::User m_user;
40
+	NetSoul::User m_me;
41
+};
42
+
43
+#endif // DIALOGCHAT_H

+ 38
- 0
netsoul/dialogchat.ui Ver arquivo

@@ -0,0 +1,38 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<ui version="4.0">
3
+ <class>DialogChat</class>
4
+ <widget class="QWidget" name="DialogChat">
5
+  <property name="geometry">
6
+   <rect>
7
+    <x>0</x>
8
+    <y>0</y>
9
+    <width>400</width>
10
+    <height>268</height>
11
+   </rect>
12
+  </property>
13
+  <property name="windowTitle">
14
+   <string>Chat</string>
15
+  </property>
16
+  <property name="styleSheet">
17
+   <string notr="true">color: white;
18
+background-color: black;</string>
19
+  </property>
20
+  <layout class="QVBoxLayout" name="verticalLayout">
21
+   <item>
22
+    <widget class="QTextEdit" name="textChat">
23
+     <property name="focusPolicy">
24
+      <enum>Qt::NoFocus</enum>
25
+     </property>
26
+     <property name="readOnly">
27
+      <bool>true</bool>
28
+     </property>
29
+    </widget>
30
+   </item>
31
+   <item>
32
+    <widget class="QLineEdit" name="lineChat"/>
33
+   </item>
34
+  </layout>
35
+ </widget>
36
+ <resources/>
37
+ <connections/>
38
+</ui>

+ 31
- 0
netsoul/dialogoptions.cpp Ver arquivo

@@ -0,0 +1,31 @@
1
+#include "dialogoptions.h"
2
+#include "ui_dialogoptions.h"
3
+
4
+DialogOptions::DialogOptions(QWidget *parent) : QDialog(parent), ui(new Ui::DialogOptions)
5
+{
6
+	ui->setupUi(this);
7
+
8
+	foreach(EpiUser usr, Epimafia::loadUsers())
9
+		if(!usr.isUnknown() && usr.hasLogin())
10
+			ui->lineDefaultLogin->addItem(usr.getLogin());
11
+
12
+	ui->checkAutoConnect->setChecked(Options::instance()->isAutoConnect());
13
+	ui->checkStartAtBoot->setChecked(Options::instance()->startAtBoot());
14
+	ui->lineDefaultLogin->lineEdit()->setText(Options::instance()->getDefaultLogin(false));
15
+	ui->spinAutoreconnectInterval->setValue(Options::instance()->getAutoReconnectInterval());
16
+	connect(this, SIGNAL(accepted()), this, SLOT(save()));
17
+
18
+}
19
+
20
+DialogOptions::~DialogOptions()
21
+{
22
+	delete ui;
23
+}
24
+
25
+void DialogOptions::save()
26
+{
27
+	Options::instance()->setAutoConnect(ui->checkAutoConnect->isChecked());
28
+	Options::instance()->setStartAtBoot(ui->checkStartAtBoot->isChecked());
29
+	Options::instance()->setDefaultLogin(ui->lineDefaultLogin->lineEdit()->text());
30
+	Options::instance()->setAutoReconnectInterval(ui->spinAutoreconnectInterval->value());
31
+}

+ 28
- 0
netsoul/dialogoptions.h Ver arquivo

@@ -0,0 +1,28 @@
1
+#ifndef DIALOGOPTIONS_H
2
+#define DIALOGOPTIONS_H
3
+
4
+#include <QDialog>
5
+#include <QLineEdit>
6
+#include "options.h"
7
+#include "epimafia.h"
8
+
9
+namespace Ui {
10
+class DialogOptions;
11
+}
12
+
13
+class DialogOptions : public QDialog
14
+{
15
+	Q_OBJECT
16
+	
17
+public:
18
+	explicit DialogOptions(QWidget *parent = 0);
19
+	~DialogOptions();
20
+	
21
+private slots:
22
+	void save();
23
+
24
+private:
25
+	Ui::DialogOptions *ui;
26
+};
27
+
28
+#endif // DIALOGOPTIONS_H

+ 182
- 0
netsoul/dialogoptions.ui Ver arquivo

@@ -0,0 +1,182 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<ui version="4.0">
3
+ <class>DialogOptions</class>
4
+ <widget class="QDialog" name="DialogOptions">
5
+  <property name="geometry">
6
+   <rect>
7
+    <x>0</x>
8
+    <y>0</y>
9
+    <width>228</width>
10
+    <height>204</height>
11
+   </rect>
12
+  </property>
13
+  <property name="windowTitle">
14
+   <string>Options</string>
15
+  </property>
16
+  <property name="styleSheet">
17
+   <string notr="true">QWidget
18
+{
19
+background-color: rgb(0, 0, 0);
20
+color: rgb(255, 255, 255);
21
+}
22
+QPushButton
23
+{
24
+border: 1px solid white;
25
+border-radius: 4px;
26
+height: 20px;
27
+min-width: 50px;
28
+}
29
+QPushButton:hover
30
+{
31
+	background-color:rgb(71, 71, 71);
32
+}
33
+QPushButton:pressed
34
+{
35
+	background-color:rgb(42, 42, 42);
36
+}
37
+QFrame, QToolTip
38
+{
39
+color: black;
40
+}
41
+QLabel
42
+{
43
+color: white;
44
+}</string>
45
+  </property>
46
+  <layout class="QVBoxLayout" name="verticalLayout">
47
+   <item>
48
+    <layout class="QFormLayout" name="formLayout">
49
+     <item row="0" column="0">
50
+      <widget class="QLabel" name="label">
51
+       <property name="text">
52
+        <string>Start at boot:</string>
53
+       </property>
54
+      </widget>
55
+     </item>
56
+     <item row="0" column="1">
57
+      <widget class="QCheckBox" name="checkStartAtBoot">
58
+       <property name="text">
59
+        <string/>
60
+       </property>
61
+      </widget>
62
+     </item>
63
+     <item row="1" column="0">
64
+      <widget class="QLabel" name="label_2">
65
+       <property name="text">
66
+        <string>Default login:</string>
67
+       </property>
68
+      </widget>
69
+     </item>
70
+     <item row="2" column="0">
71
+      <widget class="QLabel" name="label_3">
72
+       <property name="text">
73
+        <string>Auto connect at launch:</string>
74
+       </property>
75
+      </widget>
76
+     </item>
77
+     <item row="2" column="1">
78
+      <widget class="QCheckBox" name="checkAutoConnect">
79
+       <property name="text">
80
+        <string/>
81
+       </property>
82
+      </widget>
83
+     </item>
84
+     <item row="1" column="1">
85
+      <widget class="QComboBox" name="lineDefaultLogin">
86
+       <property name="styleSheet">
87
+        <string notr="true">QWidget
88
+{
89
+border: 1px solid white;
90
+border-radius: 1px;
91
+}
92
+QFrame, QToolTip
93
+{
94
+color: white;
95
+}</string>
96
+       </property>
97
+       <property name="editable">
98
+        <bool>true</bool>
99
+       </property>
100
+      </widget>
101
+     </item>
102
+     <item row="3" column="0">
103
+      <widget class="QLabel" name="label_4">
104
+       <property name="text">
105
+        <string>Auto reconnect interval:</string>
106
+       </property>
107
+      </widget>
108
+     </item>
109
+     <item row="3" column="1">
110
+      <widget class="QSpinBox" name="spinAutoreconnectInterval">
111
+       <property name="maximumSize">
112
+        <size>
113
+         <width>16777215</width>
114
+         <height>16777215</height>
115
+        </size>
116
+       </property>
117
+       <property name="suffix">
118
+        <string> ms</string>
119
+       </property>
120
+       <property name="maximum">
121
+        <number>16777215</number>
122
+       </property>
123
+       <property name="value">
124
+        <number>1000</number>
125
+       </property>
126
+      </widget>
127
+     </item>
128
+    </layout>
129
+   </item>
130
+   <item>
131
+    <widget class="QDialogButtonBox" name="buttonBox">
132
+     <property name="orientation">
133
+      <enum>Qt::Horizontal</enum>
134
+     </property>
135
+     <property name="standardButtons">
136
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
137
+     </property>
138
+    </widget>
139
+   </item>
140
+  </layout>
141
+ </widget>
142
+ <tabstops>
143
+  <tabstop>checkStartAtBoot</tabstop>
144
+  <tabstop>checkAutoConnect</tabstop>
145
+  <tabstop>buttonBox</tabstop>
146
+ </tabstops>
147
+ <resources/>
148
+ <connections>
149
+  <connection>
150
+   <sender>buttonBox</sender>
151
+   <signal>accepted()</signal>
152
+   <receiver>DialogOptions</receiver>
153
+   <slot>accept()</slot>
154
+   <hints>
155
+    <hint type="sourcelabel">
156
+     <x>248</x>
157
+     <y>254</y>
158
+    </hint>
159
+    <hint type="destinationlabel">
160
+     <x>157</x>
161
+     <y>274</y>
162
+    </hint>
163
+   </hints>
164
+  </connection>
165
+  <connection>
166
+   <sender>buttonBox</sender>
167
+   <signal>rejected()</signal>
168
+   <receiver>DialogOptions</receiver>
169
+   <slot>reject()</slot>
170
+   <hints>
171
+    <hint type="sourcelabel">
172
+     <x>316</x>
173
+     <y>260</y>
174
+    </hint>
175
+    <hint type="destinationlabel">
176
+     <x>286</x>
177
+     <y>274</y>
178
+    </hint>
179
+   </hints>
180
+  </connection>
181
+ </connections>
182
+</ui>

+ 14
- 0
netsoul/main.cpp Ver arquivo

@@ -0,0 +1,14 @@
1
+#include "mainwindow.h"
2
+#include <QApplication>
3
+#include <QTextCodec>
4
+#include "options.h"
5
+
6
+int main(int argc, char *argv[])
7
+{
8
+    QApplication a(argc, argv);
9
+    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
10
+	qApp->setQuitOnLastWindowClosed(false);
11
+	MainWindow w;
12
+    
13
+    return a.exec();
14
+}

+ 176
- 0
netsoul/mainwindow.cpp Ver arquivo

@@ -0,0 +1,176 @@
1
+#include "mainwindow.h"
2
+#include "ui_mainwindow.h"
3
+
4
+MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
5
+{
6
+	Options::init(this);
7
+	ui->setupUi(this);
8
+	setFixedSize(size());
9
+	m_chatMgr = new ChatManager(this);
10
+
11
+	m_labelState = new QLabel();
12
+	ui->statusbar->addPermanentWidget(m_labelState);
13
+	m_labelState->setText(NetSoul::getStringFromState(NetSoul::Disconnected));
14
+	ui->actionDisconnect->setEnabled(false);
15
+	ui->actionAddContact->setEnabled(false);
16
+	ui->contactsWidget->hide();
17
+
18
+	m_tray = new QSystemTrayIcon(QIcon(":/epimafia/icon_red.jpg"), this);
19
+	m_tray->setToolTip("Epimafia NetSoul - Disconnected");
20
+	m_tray->show();
21
+	QMenu* menu = new QMenu("Epimafia NetSoul", this);
22
+	connect(menu->addAction("Show"), SIGNAL(triggered()), this, SLOT(showAndRaise()));
23
+	menu->addSeparator();
24
+	menu->addAction(ui->actionConnect);
25
+	menu->addAction(ui->actionDisconnect);
26
+	menu->addSeparator();
27
+	connect(menu->addAction("Options"), SIGNAL(triggered()), this, SLOT(options()));
28
+	connect(menu->addAction("Quit"), SIGNAL(triggered()), qApp, SLOT(quit()));
29
+	m_tray->setContextMenu(menu);
30
+	connect(m_tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayActivated(QSystemTrayIcon::ActivationReason)));
31
+
32
+	m_netsoul = new NetSoul(this);
33
+	connect(m_netsoul, SIGNAL(stateChanged(NetSoul::State)), this, SLOT(nsStateChanged(NetSoul::State)));
34
+	connect(m_netsoul, SIGNAL(unknownCommand(QString)), this, SLOT(nsUnknownCommand(QString)));
35
+
36
+	connect(m_netsoul, SIGNAL(stateChanged(NetSoul::State)), ui->loginWidget, SLOT(nsStateChanged(NetSoul::State)));
37
+	connect(m_netsoul, SIGNAL(userDataChanged(NetSoul::User)), ui->contactsWidget, SLOT(nsUserDataChanged(NetSoul::User)));
38
+	connect(m_netsoul, SIGNAL(stateChanged(NetSoul::State)), ui->contactsWidget, SLOT(nsStateChanged(NetSoul::State)));
39
+
40
+	connect(ui->loginWidget, SIGNAL(loginRequested(EpiUser)), m_netsoul, SLOT(login(EpiUser)));
41
+	connect(ui->contactsWidget, SIGNAL(userStateChanged(NetSoul::UserState)), m_netsoul, SLOT(setUserState(NetSoul::UserState)));
42
+	connect(ui->contactsWidget, SIGNAL(removeFromContactsRequested(QStringList)), this, SLOT(removeContacts(QStringList)));
43
+	connect(ui->contactsWidget, SIGNAL(chatRequested(NetSoul::Users)), m_chatMgr, SLOT(chat(NetSoul::Users)));
44
+	connect(ui->actionConnect, SIGNAL(triggered()), ui->loginWidget, SLOT(login()));
45
+	connect(ui->actionDisconnect, SIGNAL(triggered()), m_netsoul, SLOT(logout()));
46
+	connect(ui->actionQuit, SIGNAL(triggered()), qApp, SLOT(quit()));
47
+	connect(ui->actionOptions, SIGNAL(triggered()), this, SLOT(options()));
48
+	connect(ui->actionAddContact, SIGNAL(triggered()), this, SLOT(addContact()));
49
+	connect(m_chatMgr, SIGNAL(sendMessageRequested(NetSoul::User,QString)), m_netsoul, SLOT(sendMessage(NetSoul::User,QString)));
50
+
51
+	connect(m_netsoul, SIGNAL(newMessage(NetSoul::Message)), m_chatMgr, SLOT(newMessage(NetSoul::Message)));
52
+
53
+	m_contacts = Options::instance()->getContacts();
54
+	if(Options::instance()->isAutoConnect() && ui->loginWidget->hasLogin(Options::instance()->getDefaultLogin()))
55
+		ui->loginWidget->login();
56
+	else
57
+		show();
58
+}
59
+
60
+MainWindow::~MainWindow()
61
+{
62
+	delete ui;
63
+}
64
+
65
+void MainWindow::closeEvent(QCloseEvent *)
66
+{
67
+	if(qApp->arguments().contains("-debug"))
68
+		qApp->exit(0);
69
+}
70
+
71
+void MainWindow::showAndRaise()
72
+{
73
+	show();
74
+	raise();
75
+}
76
+
77
+void MainWindow::toggleVisibility()
78
+{
79
+	if(isVisible())
80
+		hide();
81
+	else
82
+		showAndRaise();
83
+}
84
+
85
+void MainWindow::options()
86
+{
87
+	DialogOptions dlg;
88
+	dlg.exec();
89
+}
90
+
91
+void MainWindow::addContact()
92
+{
93
+	DialogAddContact dlg;
94
+	connect(&dlg, SIGNAL(contactAdded(QString)), this, SLOT(addContact(QString)));
95
+	connect(&dlg, SIGNAL(chatRequested(NetSoul::Users)), m_chatMgr, SLOT(chat(NetSoul::Users)));
96
+	m_netsoul->listUsers(&dlg, SLOT(setUsers(NetSoul::Users)));
97
+	dlg.exec();
98
+}
99
+
100
+void MainWindow::addContact(QString contact)
101
+{
102
+	addContacts(QStringList() << contact);
103
+}
104
+
105
+void MainWindow::addContacts(QStringList contacts)
106
+{
107
+	for(int i = 0; i < contacts.size(); ++i)
108
+		if(m_contacts.contains(contacts.at(i)) || m_netsoul->getUser().login == contacts.at(i))
109
+			contacts.removeAt(i--);
110
+	m_contacts.append(contacts);
111
+	Options::instance()->setContacts(m_contacts);
112
+	ui->contactsWidget->addContacts(contacts);
113
+	m_netsoul->addToWatchList(contacts);
114
+	m_netsoul->whois(contacts);
115
+}
116
+
117
+void MainWindow::removeContacts(QStringList contacts)
118
+{
119
+	foreach(QString contact, contacts)
120
+		if(contact != m_netsoul->getUser().login && m_contacts.removeAll(contact) != 0)
121
+			ui->contactsWidget->removeFromContacts(contact);
122
+	Options::instance()->setContacts(m_contacts);
123
+}
124
+
125
+void MainWindow::nsStateChanged(NetSoul::State s)
126
+{
127
+	m_tray->setToolTip("Epimafia NetSoul - " + NetSoul::getStringFromState(s));
128
+	if(s == NetSoul::LoggedIn)
129
+	{
130
+		m_tray->setIcon(QIcon(":/epimafia/icon.jpg"));
131
+		QStringList contacts = m_contacts;
132
+		if(!contacts.contains(m_netsoul->getUser().login))
133
+			contacts += (QStringList() << m_netsoul->getUser().login);
134
+
135
+		m_netsoul->addToWatchList(contacts);
136
+		m_netsoul->whois(contacts);
137
+		ui->contactsWidget->addContacts(contacts);
138
+		m_chatMgr->setMe(m_netsoul->getUser());
139
+		m_tray->setToolTip("Epimafia NetSoul - " + m_netsoul->getUser().login + " - " + NetSoul::getStringFromState(s));
140
+	}
141
+	else if(s == NetSoul::Disconnected || s == NetSoul::Disconnecting || s == NetSoul::NetworkError || s == NetSoul::ProtocolError || s == NetSoul::BadLogin)
142
+		m_tray->setIcon(QIcon(":/epimafia/icon_red.jpg"));
143
+	else
144
+		m_tray->setIcon(QIcon(":/epimafia/icon_blue.jpg"));
145
+
146
+	if(s == NetSoul::LoggedIn)
147
+		m_labelState->setText(m_netsoul->getEpiUser().getLogin() + " - " + NetSoul::getStringFromState(s));
148
+	else if(s == NetSoul::NetworkError)
149
+	{
150
+		const QMetaObject & mo = QAbstractSocket::staticMetaObject;
151
+		QMetaEnum me = mo.enumerator(mo.indexOfEnumerator("SocketError"));
152
+		m_labelState->setText(NetSoul::getStringFromState(s) + " - " + me.valueToKey(m_netsoul->getLastNetworkError()));
153
+	}
154
+	else
155
+		m_labelState->setText(NetSoul::getStringFromState(s));
156
+
157
+	ui->actionConnect->setEnabled(s == NetSoul::Disconnected || s == NetSoul::ProtocolError || s == NetSoul::NetworkError || s == NetSoul::BadLogin);
158
+	ui->actionDisconnect->setEnabled(!ui->actionConnect->isEnabled());
159
+	ui->loginWidget->setVisible(s != NetSoul::LoggedIn);
160
+	ui->contactsWidget->setVisible(s == NetSoul::LoggedIn);
161
+	ui->actionAddContact->setEnabled(s == NetSoul::LoggedIn);
162
+
163
+	if(s == NetSoul::NetworkError || s == NetSoul::ProtocolError)
164
+		QTimer::singleShot(Options::instance()->getAutoReconnectInterval(), ui->loginWidget, SLOT(login()));
165
+}
166
+
167
+void MainWindow::nsUnknownCommand(QString cmd)
168
+{
169
+	qDebug()<<"Unknown command:"<<cmd;
170
+}
171
+
172
+void MainWindow::trayActivated(QSystemTrayIcon::ActivationReason r)
173
+{
174
+	if(r == QSystemTrayIcon::DoubleClick)
175
+		toggleVisibility();
176
+}

+ 53
- 0
netsoul/mainwindow.h Ver arquivo

@@ -0,0 +1,53 @@
1
+#ifndef MAINWINDOW_H
2
+#define MAINWINDOW_H
3
+
4
+#include <QMainWindow>
5
+#include <QLabel>
6
+#include <QSystemTrayIcon>
7
+#include <QCloseEvent>
8
+#include <QSettings>
9
+#include "netsoul.h"
10
+#include "dialogaddcontact.h"
11
+#include "chatmanager.h"
12
+#include "options.h"
13
+#include "dialogoptions.h"
14
+
15
+namespace Ui {
16
+class MainWindow;
17
+}
18
+
19
+class MainWindow : public QMainWindow
20
+{
21
+    Q_OBJECT
22
+    
23
+public:
24
+    explicit MainWindow(QWidget *parent = 0);
25
+    ~MainWindow();
26
+
27
+protected:
28
+    void closeEvent(QCloseEvent *);
29
+
30
+public slots:
31
+    void showAndRaise();
32
+    void toggleVisibility();
33
+    void options();
34
+    void addContact();
35
+    void addContact(QString contact);
36
+    void addContacts(QStringList contacts);
37
+	void removeContacts(QStringList contacts);
38
+
39
+private slots:
40
+	void nsStateChanged(NetSoul::State s);
41
+    void nsUnknownCommand(QString cmd);
42
+	void trayActivated(QSystemTrayIcon::ActivationReason r);
43
+    
44
+private:
45
+    Ui::MainWindow *ui;
46
+    NetSoul* m_netsoul;
47
+    QLabel* m_labelState;
48
+	QSystemTrayIcon* m_tray;
49
+    QStringList m_contacts;
50
+	ChatManager* m_chatMgr;
51
+};
52
+
53
+#endif // MAINWINDOW_H

+ 189
- 0
netsoul/mainwindow.ui Ver arquivo

@@ -0,0 +1,189 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<ui version="4.0">
3
+ <class>MainWindow</class>
4
+ <widget class="QMainWindow" name="MainWindow">
5
+  <property name="geometry">
6
+   <rect>
7
+    <x>0</x>
8
+    <y>0</y>
9
+    <width>260</width>
10
+    <height>390</height>
11
+   </rect>
12
+  </property>
13
+  <property name="windowTitle">
14
+   <string>Epimafia Soul - Epimafia</string>
15
+  </property>
16
+  <property name="windowIcon">
17
+   <iconset>
18
+    <normaloff>:/icon.jpg</normaloff>:/icon.jpg</iconset>
19
+  </property>
20
+  <property name="styleSheet">
21
+   <string notr="true"/>
22
+  </property>
23
+  <widget class="QWidget" name="centralwidget">
24
+   <property name="styleSheet">
25
+    <string notr="true">background-color: black;
26
+color: white;</string>
27
+   </property>
28
+   <layout class="QVBoxLayout" name="verticalLayout">
29
+    <item>
30
+     <layout class="QHBoxLayout" name="horizontalLayout">
31
+      <item>
32
+       <spacer name="horizontalSpacer">
33
+        <property name="orientation">
34
+         <enum>Qt::Horizontal</enum>
35
+        </property>
36
+        <property name="sizeHint" stdset="0">
37
+         <size>
38
+          <width>40</width>
39
+          <height>20</height>
40
+         </size>
41
+        </property>
42
+       </spacer>
43
+      </item>
44
+      <item>
45
+       <widget class="QLabel" name="label">
46
+        <property name="minimumSize">
47
+         <size>
48
+          <width>150</width>
49
+          <height>75</height>
50
+         </size>
51
+        </property>
52
+        <property name="maximumSize">
53
+         <size>
54
+          <width>150</width>
55
+          <height>75</height>
56
+         </size>
57
+        </property>
58
+        <property name="text">
59
+         <string/>
60
+        </property>
61
+        <property name="pixmap">
62
+         <pixmap resource="../Epimafia/rc.qrc">:/epimafia/epimafia.jpg</pixmap>
63
+        </property>
64
+        <property name="scaledContents">
65
+         <bool>true</bool>
66
+        </property>
67
+       </widget>
68
+      </item>
69
+      <item>
70
+       <spacer name="horizontalSpacer_2">
71
+        <property name="orientation">
72
+         <enum>Qt::Horizontal</enum>
73
+        </property>
74
+        <property name="sizeHint" stdset="0">
75
+         <size>
76
+          <width>40</width>
77
+          <height>20</height>
78
+         </size>
79
+        </property>
80
+       </spacer>
81
+      </item>
82
+     </layout>
83
+    </item>
84
+    <item>
85
+     <widget class="ConnectWidget" name="loginWidget" native="true">
86
+      <property name="sizePolicy">
87
+       <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
88
+        <horstretch>0</horstretch>
89
+        <verstretch>0</verstretch>
90
+       </sizepolicy>
91
+      </property>
92
+     </widget>
93
+    </item>
94
+    <item>
95
+     <widget class="ContactsWidget" name="contactsWidget" native="true">
96
+      <property name="sizePolicy">
97
+       <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
98
+        <horstretch>0</horstretch>
99
+        <verstretch>0</verstretch>
100
+       </sizepolicy>
101
+      </property>
102
+     </widget>
103
+    </item>
104
+   </layout>
105
+  </widget>
106
+  <widget class="QMenuBar" name="menubar">
107
+   <property name="geometry">
108
+    <rect>
109
+     <x>0</x>
110
+     <y>0</y>
111
+     <width>260</width>
112
+     <height>21</height>
113
+    </rect>
114
+   </property>
115
+   <widget class="QMenu" name="menuFichier">
116
+    <property name="title">
117
+     <string>File</string>
118
+    </property>
119
+    <addaction name="actionConnect"/>
120
+    <addaction name="actionDisconnect"/>
121
+    <addaction name="separator"/>
122
+    <addaction name="actionQuit"/>
123
+   </widget>
124
+   <widget class="QMenu" name="menuOptions">
125
+    <property name="title">
126
+     <string>Options</string>
127
+    </property>
128
+    <addaction name="actionOptions"/>
129
+   </widget>
130
+   <widget class="QMenu" name="menuChat">
131
+    <property name="title">
132
+     <string>Contacts</string>
133
+    </property>
134
+    <addaction name="actionAddContact"/>
135
+   </widget>
136
+   <addaction name="menuFichier"/>
137
+   <addaction name="menuChat"/>
138
+   <addaction name="menuOptions"/>
139
+  </widget>
140
+  <widget class="QStatusBar" name="statusbar">
141
+   <property name="sizeGripEnabled">
142
+    <bool>false</bool>
143
+   </property>
144
+  </widget>
145
+  <action name="actionConnect">
146
+   <property name="text">
147
+    <string>Connect</string>
148
+   </property>
149
+  </action>
150
+  <action name="actionDisconnect">
151
+   <property name="text">
152
+    <string>Disconnect</string>
153
+   </property>
154
+  </action>
155
+  <action name="actionOptions">
156
+   <property name="text">
157
+    <string>Options...</string>
158
+   </property>
159
+  </action>
160
+  <action name="actionAddContact">
161
+   <property name="text">
162
+    <string>Add...</string>
163
+   </property>
164
+  </action>
165
+  <action name="actionQuit">
166
+   <property name="text">
167
+    <string>Quit</string>
168
+   </property>
169
+  </action>
170
+ </widget>
171
+ <customwidgets>
172
+  <customwidget>
173
+   <class>ConnectWidget</class>
174
+   <extends>QWidget</extends>
175
+   <header>connectwidget.h</header>
176
+   <container>1</container>
177
+  </customwidget>
178
+  <customwidget>
179
+   <class>ContactsWidget</class>
180
+   <extends>QWidget</extends>
181
+   <header>contactswidget.h</header>
182
+   <container>1</container>
183
+  </customwidget>
184
+ </customwidgets>
185
+ <resources>
186
+  <include location="../Epimafia/rc.qrc"/>
187
+ </resources>
188
+ <connections/>
189
+</ui>

+ 52
- 0
netsoul/netsoul.pro Ver arquivo

@@ -0,0 +1,52 @@
1
+#-------------------------------------------------
2
+#
3
+# Project created by QtCreator 2013-09-18T23:33:04
4
+#
5
+#-------------------------------------------------
6
+
7
+QT       += core gui network
8
+
9
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
10
+
11
+TARGET = netsoul
12
+TEMPLATE = app
13
+
14
+
15
+SOURCES += main.cpp\
16
+    mainwindow.cpp \
17
+    connectwidget.cpp \
18
+    contactswidget.cpp \
19
+    dialogaddcontact.cpp \
20
+    usertreewidget.cpp \
21
+    dialogchat.cpp \
22
+    chatmanager.cpp \
23
+    dialogoptions.cpp \
24
+    options.cpp
25
+
26
+HEADERS  += \
27
+    mainwindow.h \
28
+    connectwidget.h \
29
+    contactswidget.h \
30
+    dialogaddcontact.h \
31
+    usertreewidget.h \
32
+    dialogchat.h \
33
+    chatmanager.h \
34
+    dialogoptions.h \
35
+    options.h
36
+
37
+FORMS    += \
38
+    mainwindow.ui \
39
+    connectwidget.ui \
40
+    contactswidget.ui \
41
+	dialogaddcontact.ui \
42
+    dialogchat.ui \
43
+    dialogoptions.ui
44
+
45
+RC_FILE = rc.rc
46
+
47
+win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../Epimafia/release/ -lEpimafia
48
+else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../Epimafia/debug/ -lEpimafia
49
+else:unix: LIBS += -L$$OUT_PWD/../Epimafia/ -lEpimafia
50
+
51
+INCLUDEPATH += $$PWD/../Epimafia
52
+DEPENDPATH += $$PWD/../Epimafia

+ 93
- 0
netsoul/options.cpp Ver arquivo

@@ -0,0 +1,93 @@
1
+#include "options.h"
2
+
3
+Options* Options::m_options = 0;
4
+
5
+Options*Options::instance()
6
+{
7
+	return m_options;
8
+}
9
+
10
+void Options::init(QObject* p)
11
+{
12
+	m_options = new Options(p);
13
+}
14
+
15
+bool Options::startAtBoot()
16
+{
17
+#ifdef Q_OS_WIN
18
+	QSettings set("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
19
+	return set.childKeys().contains("Epimafia Netsoul");
20
+#else
21
+#error "OS sepcific"
22
+#endif
23
+}
24
+
25
+QString Options::getDefaultLogin(bool override)
26
+{
27
+	if(override)
28
+	{
29
+		QStringList args = qApp->arguments();
30
+		int index = args.indexOf("-login");
31
+		if(index != -1 && index < args.size() - 1)
32
+			return args.at(index + 1);
33
+	}
34
+
35
+	return m_settings.value("defaultLogin").toString();
36
+}
37
+
38
+bool Options::isAutoConnect()
39
+{
40
+	return m_settings.value("autoConnect", false).toBool();
41
+}
42
+
43
+QStringList Options::getContacts()
44
+{
45
+	return qvariant_cast<QStringList>(m_settings.value("contacts"));
46
+}
47
+
48
+int Options::getAutoReconnectInterval()
49
+{
50
+	return m_settings.value("autoreconnectInterval", 1000).toInt();
51
+}
52
+
53
+void Options::setStartAtBoot(bool s)
54
+{
55
+#ifdef Q_OS_WIN
56
+	QSettings set("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
57
+	if(s)
58
+		set.setValue("Epimafia Netsoul", "\"" + qApp->applicationFilePath() + "\"");
59
+	else
60
+		set.remove("Epimafia Netsoul");
61
+#else
62
+#error "OS specific"
63
+#endif
64
+}
65
+
66
+void Options::setDefaultLogin(QString login)
67
+{
68
+	m_settings.setValue("defaultLogin", login);
69
+}
70
+
71
+void Options::setAutoConnect(bool c)
72
+{
73
+	m_settings.setValue("autoConnect", c);
74
+}
75
+
76
+void Options::setContacts(QStringList contacts)
77
+{
78
+	m_settings.setValue("contacts", contacts);
79
+}
80
+
81
+void Options::setAutoReconnectInterval(int t)
82
+{
83
+	m_settings.setValue("autoreconnectInterval", t);
84
+}
85
+
86
+Options::Options(QObject *parent) : QObject(parent),
87
+	#ifdef Q_OS_WIN
88
+	m_settings("epimafianetsoul.ini", QSettings::IniFormat)
89
+	#else
90
+	#error "OS specific"
91
+	#endif
92
+{
93
+}

+ 37
- 0
netsoul/options.h Ver arquivo

@@ -0,0 +1,37 @@
1
+#ifndef OPTIONS_H
2
+#define OPTIONS_H
3
+
4
+#include <QObject>
5
+#include <QSettings>
6
+#include <QStringList>
7
+#include <QDebug>
8
+#include <QApplication>
9
+
10
+class Options : public QObject
11
+{
12
+	Q_OBJECT
13
+public:
14
+	static Options* instance();
15
+	static void init(QObject* p = 0);
16
+
17
+	bool startAtBoot();
18
+	QString getDefaultLogin(bool override = true);
19
+	bool isAutoConnect();
20
+	QStringList getContacts();
21
+	int getAutoReconnectInterval();
22
+	
23
+public slots:
24
+	void setStartAtBoot(bool s);
25
+	void setDefaultLogin(QString login);
26
+	void setAutoConnect(bool c);
27
+	void setContacts(QStringList contacts);
28
+	void setAutoReconnectInterval(int t);
29
+
30
+private:
31
+	explicit Options(QObject *parent = 0);
32
+	static Options* m_options;
33
+	QSettings m_settings;
34
+	
35
+};
36
+
37
+#endif // OPTIONS_H

+ 1
- 0
netsoul/rc.rc Ver arquivo

@@ -0,0 +1 @@
1
+IDI_ICON1               ICON    DISCARDABLE     "../Epimafia/icon.ico"

+ 179
- 0
netsoul/usertreewidget.cpp Ver arquivo

@@ -0,0 +1,179 @@
1
+#include "usertreewidget.h"
2
+
3
+UserTreeWidget::UserTreeWidget(QWidget *parent) : QTreeWidget(parent)
4
+{
5
+    QTreeWidgetItem* header = headerItem();
6
+    int c = 0;
7
+    header->setText(c++, "Login");
8
+    header->setText(c++, "IP");
9
+    header->setText(c++, "Location");
10
+    header->setText(c++, "State");
11
+    header->setText(c++, "Promo");
12
+    header->setText(c++, "Data");
13
+    header->setText(c++, "ID");
14
+    setRootIsDecorated(false);
15
+    setSortingEnabled(true);
16
+    setStyleSheet("QHeaderView::section\n{\ncolor: black;\n}");
17
+    connect(this, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*,int)));
18
+    sortByColumn(0, Qt::AscendingOrder);
19
+    setSelectionMode(QAbstractItemView::ExtendedSelection);
20
+    setContextMenuPolicy(Qt::CustomContextMenu);
21
+}
22
+
23
+NetSoul::User UserTreeWidget::getSelectedUser()
24
+{
25
+    if(!currentItem())
26
+        return NetSoul::User();
27
+    return qvariant_cast<NetSoul::User>(currentItem()->data(0, Qt::UserRole));
28
+}
29
+
30
+NetSoul::Users UserTreeWidget::getSelectedUsers()
31
+{
32
+    NetSoul::Users users;
33
+
34
+    foreach(QTreeWidgetItem* item, selectedItems())
35
+        users.append(qvariant_cast<NetSoul::User>(item->data(0, Qt::UserRole)));
36
+
37
+    return users;
38
+}
39
+
40
+void UserTreeWidget::updateUser(NetSoul::User user)
41
+{
42
+    bool found = false;
43
+    for(int i = 0; i < topLevelItemCount(); ++i)
44
+    {
45
+        QTreeWidgetItem* item = topLevelItem(i);
46
+        if(item->text(0) == user.login)
47
+        {
48
+            found = true;
49
+            if(item->data(1, Qt::UserRole).toString() == user.id || item->data(1, Qt::UserRole).isNull())
50
+            {
51
+                if(user.state != NetSoul::UserStateNotSet)
52
+                {
53
+                    if(user.state == NetSoul::Actif || user.state == NetSoul::Login)
54
+                        item->setIcon(0, QIcon(":/epimafia/icon_green.jpg"));
55
+                    else if(user.state == NetSoul::Away)
56
+                        item->setIcon(0, QIcon(":/epimafia/icon_blue.jpg"));
57
+                    else if(user.state == NetSoul::Lock)
58
+                        item->setIcon(0, QIcon(":/epimafia/icon_red.jpg"));
59
+                    else
60
+                    {
61
+                        for(int i = 0; i < topLevelItemCount(); ++i)
62
+                        {
63
+                            QTreeWidgetItem* an = topLevelItem(i);
64
+                            if(an != item && an->text(0) == user.login)
65
+                            {
66
+                                delete item;
67
+                                return;
68
+                            }
69
+                        }
70
+                        item->setIcon(0, QIcon(":/epimafia/icon.jpg"));
71
+                        for(int i = 1; i < 7; ++i)
72
+                            item->setText(i, "");
73
+                        return;
74
+                    }
75
+                    if(user.state != NetSoul::UnknownState)
76
+                        item->setText(3, NetSoul::getStringFromUserState(user.state));
77
+                    else
78
+                        item->setText(3, user.stateString);
79
+                }
80
+                QVariant v;
81
+                v.setValue(user);
82
+                item->setData(0, Qt::UserRole, v);
83
+                item->setData(1, Qt::UserRole, user.id);
84
+                if(!user.ip.isNull())
85
+                    item->setText(1, user.ip);
86
+                if(!user.location.isNull())
87
+                    item->setText(2, user.location);
88
+                if(!user.promo.isNull())
89
+                    item->setText(4, user.promo);
90
+                if(!user.data.isEmpty())
91
+                    item->setText(5, user.data);
92
+                if(!user.id.isNull())
93
+                    item->setText(6, user.id);
94
+                return;
95
+            }
96
+        }
97
+    }
98
+    if(found)
99
+        addUser(user);
100
+}
101
+
102
+void UserTreeWidget::updateUsers(NetSoul::Users users)
103
+{
104
+    foreach (NetSoul::User user, users)
105
+        updateUser(user);
106
+}
107
+
108
+void UserTreeWidget::addUser(NetSoul::User user)
109
+{
110
+    QTreeWidgetItem* item = new QTreeWidgetItem();
111
+    int c = 0;
112
+    item->setData(1, Qt::UserRole, user.id);
113
+    item->setText(c++, user.login);
114
+    item->setText(c++, user.ip);
115
+    item->setText(c++, user.location);
116
+    if(user.state != NetSoul::UnknownState)
117
+        item->setText(c++, NetSoul::getStringFromUserState(user.state));
118
+    else
119
+        item->setText(c++, user.stateString);
120
+    item->setText(c++, user.promo);
121
+    item->setText(c++, user.data);
122
+    item->setText(c++, user.id);
123
+    if(user.state == NetSoul::Actif || user.state == NetSoul::Login)
124
+        item->setIcon(0, QIcon(":/epimafia/icon_green.jpg"));
125
+    else if(user.state == NetSoul::Away)
126
+        item->setIcon(0, QIcon(":/epimafia/icon_blue.jpg"));
127
+    else if(user.state == NetSoul::Lock)
128
+        item->setIcon(0, QIcon(":/epimafia/icon_red.jpg"));
129
+    else
130
+        item->setIcon(0, QIcon(":/epimafia/icon.jpg"));
131
+    QVariant v;
132
+    v.setValue(user);
133
+    item->setData(0, Qt::UserRole, v);
134
+    addTopLevelItem(item);
135
+}
136
+
137
+void UserTreeWidget::addUsers(NetSoul::Users users)
138
+{
139
+    foreach(NetSoul::User user, users)
140
+        addUser(user);
141
+}
142
+
143
+void UserTreeWidget::remove(QStringList logins)
144
+{
145
+    for(int i = 0; i < topLevelItemCount(); ++i)
146
+    {
147
+        QTreeWidgetItem* item = topLevelItem(i);
148
+        if(logins.contains(item->text(0)))
149
+        {
150
+            delete item;
151
+            --i;
152
+        }
153
+    }
154
+}
155
+
156
+void UserTreeWidget::filter(QString text)
157
+{
158
+    for(int i = 0; i < topLevelItemCount(); ++i)
159
+        topLevelItem(i)->setHidden(!itemContains(topLevelItem(i), text));
160
+}
161
+
162
+void UserTreeWidget::resetUsers()
163
+{
164
+    for(int i = 0; i < topLevelItemCount(); ++i)
165
+        topLevelItem(i)->setIcon(0, QIcon(":/epimafia/icon.jpg"));
166
+}
167
+
168
+void UserTreeWidget::itemDoubleClicked(QTreeWidgetItem *item, int)
169
+{
170
+    emit userSelected(qvariant_cast<NetSoul::User>(item->data(0, Qt::UserRole)));
171
+}
172
+
173
+bool UserTreeWidget::itemContains(QTreeWidgetItem *item, QString text)
174
+{
175
+    for(int i = 0; i < item->columnCount(); ++i)
176
+        if(item->text(i).contains(text))
177
+            return true;
178
+    return false;
179
+}

+ 176
- 0
netsoul/usertreewidget.cpp~ Ver arquivo

@@ -0,0 +1,176 @@
1
+#include "usertreewidget.h"
2
+
3
+UserTreeWidget::UserTreeWidget(QWidget *parent) : QTreeWidget(parent)
4
+{
5
+    QTreeWidgetItem* header = headerItem();
6
+    int c = 0;
7
+    header->setText(c++, "Login");
8
+    header->setText(c++, "IP");
9
+    header->setText(c++, "Location");
10
+    header->setText(c++, "State");
11
+    header->setText(c++, "Promo");
12
+    header->setText(c++, "Data");
13
+    header->setText(c++, "ID");
14
+    setRootIsDecorated(false);
15
+    setSortingEnabled(true);
16
+    setStyleSheet("QHeaderView::section\n{\ncolor: black;\n}");
17
+    connect(this, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*,int)));
18
+    sortByColumn(0, Qt::AscendingOrder);
19
+    setSelectionMode(QAbstractItemView::ExtendedSelection);
20
+    setContextMenuPolicy(Qt::CustomContextMenu);
21
+}
22
+
23
+NetSoul::User UserTreeWidget::getSelectedUser()
24
+{
25
+    if(!currentItem())
26
+        return NetSoul::User();
27
+    return qvariant_cast<NetSoul::User>(currentItem()->data(0, Qt::UserRole));
28
+}
29
+
30
+NetSoul::Users UserTreeWidget::getSelectedUsers()
31
+{
32
+    NetSoul::Users users;
33
+
34
+    foreach(QTreeWidgetItem* item, selectedItems())
35
+        users.append(qvariant_cast<NetSoul::User>(item->data(0, Qt::UserRole)));
36
+
37
+    return users;
38
+}
39
+
40
+void UserTreeWidget::updateUser(NetSoul::User user)
41
+{
42
+    bool found = false;
43
+    for(int i = 0; i < topLevelItemCount(); ++i)
44
+    {
45
+        QTreeWidgetItem* item = topLevelItem(i);
46
+        if(item->text(0) == user.login)
47
+        {
48
+            found = true;
49
+            if(item->data(1, Qt::UserRole).toString() == user.id || item->data(1, Qt::UserRole).isNull())
50
+            {
51
+                if(user.state != NetSoul::UserStateNotSet)
52
+                {
53
+                    if(user.state == NetSoul::Actif || user.state == NetSoul::Login)
54
+                        item->setIcon(0, QIcon(":/epimafia/icon_green.jpg"));
55
+                    else if(user.state == NetSoul::Away)
56
+                        item->setIcon(0, QIcon(":/epimafia/icon_blue.jpg"));
57
+                    else if(user.state == NetSoul::Lock)
58
+                        item->setIcon(0, QIcon(":/epimafia/icon_red.jpg"));
59
+                    else
60
+                    {
61
+                        for(int i = 0; i < topLevelItemCount(); ++i)
62
+                        {
63
+                            QTreeWidgetItem* an = topLevelItem(i);
64
+                            if(an != item && an->text(0) == user.login)
65
+                            {
66
+                                delete item;
67
+                                return;
68
+                            }
69
+                        }
70
+                        item->setIcon(0, QIcon(":/epimafia/icon.jpg"));
71
+                        for(int i = 1; i < 7; ++i)
72
+                            item->setText(i, "");
73
+                        return;
74
+                    }
75
+                    if(user.state != NetSoul::UnknownState)
76
+                        item->setText(3, NetSoul::getStringFromUserState(user.state));
77
+                    else
78
+                        item->setText(3, user.stateString);
79
+                }
80
+                QVariant v;
81
+                v.setValue(user);
82
+                item->setData(0, Qt::UserRole, v);
83
+                item->setData(1, Qt::UserRole, user.id);
84
+                if(!user.ip.isNull())
85
+                    item->setText(1, user.ip);
86
+                if(!user.location.isNull())
87
+                    item->setText(2, user.location);
88
+                if(!user.promo.isNull())
89
+                    item->setText(4, user.promo);
90
+                if(!user.data.isEmpty())
91
+                    item->setText(5, user.data);
92
+                if(!user.id.isNull())
93
+                    item->setText(6, user.id);
94
+                return;
95
+            }
96
+        }
97
+    }
98
+    if(found)
99
+        addUser(user);
100
+}
101
+
102
+void UserTreeWidget::updateUsers(NetSoul::Users users)
103
+{
104
+    foreach (NetSoul::User user, users)
105
+        updateUser(user);
106
+}
107
+
108
+void UserTreeWidget::addUser(NetSoul::User user)
109
+{
110
+    QTreeWidgetItem* item = new QTreeWidgetItem();
111
+    int c = 0;
112
+    item->setData(1, Qt::UserRole, user.id);
113
+    item->setText(c++, user.login);
114
+    item->setText(c++, user.ip);
115
+    item->setText(c++, user.location);
116
+    if(user.state != NetSoul::UnknownState)
117
+        item->setText(c++, NetSoul::getStringFromUserState(user.state));
118
+    else
119
+        item->setText(c++, user.stateString);
120
+    item->setText(c++, user.promo);
121
+    item->setText(c++, user.data);
122
+    item->setText(c++, user.id);
123
+    if(user.state == NetSoul::Actif || user.state == NetSoul::Login)
124
+        item->setIcon(0, QIcon(":/epimafia/icon_green.jpg"));
125
+    else if(user.state == NetSoul::Away)
126
+        item->setIcon(0, QIcon(":/epimafia/icon_blue.jpg"));
127
+    else if(user.state == NetSoul::Lock)
128
+        item->setIcon(0, QIcon(":/epimafia/icon_red.jpg"));
129
+    else
130
+        item->setIcon(0, QIcon(":/epimafia/icon.jpg"));
131
+    QVariant v;
132
+    v.setValue(user);
133
+    item->setData(0, Qt::UserRole, v);
134
+    addTopLevelItem(item);
135
+}
136
+
137
+void UserTreeWidget::addUsers(NetSoul::Users users)
138
+{
139
+    foreach(NetSoul::User user, users)
140
+        addUser(user);
141
+}
142
+
143
+void UserTreeWidget::remove(QStringList logins)
144
+{
145
+    for(int i = 0; i < topLevelItemCount(); ++i)
146
+    {
147
+        QTreeWidgetItem* item = topLevelItem(i);
148
+        if(logins.contains(item->text(0)))
149
+            delete item;
150
+    }
151
+}
152
+
153
+void UserTreeWidget::filter(QString text)
154
+{
155
+    for(int i = 0; i < topLevelItemCount(); ++i)
156
+        topLevelItem(i)->setHidden(!itemContains(topLevelItem(i), text));
157
+}
158
+
159
+void UserTreeWidget::resetUsers()
160
+{
161
+    for(int i = 0; i < topLevelItemCount(); ++i)
162
+        topLevelItem(i)->setIcon(0, QIcon(":/epimafia/icon.jpg"));
163
+}
164
+
165
+void UserTreeWidget::itemDoubleClicked(QTreeWidgetItem *item, int)
166
+{
167
+    emit userSelected(qvariant_cast<NetSoul::User>(item->data(0, Qt::UserRole)));
168
+}
169
+
170
+bool UserTreeWidget::itemContains(QTreeWidgetItem *item, QString text)
171
+{
172
+    for(int i = 0; i < item->columnCount(); ++i)
173
+        if(item->text(i).contains(text))
174
+            return true;
175
+    return false;
176
+}

+ 37
- 0
netsoul/usertreewidget.h Ver arquivo

@@ -0,0 +1,37 @@
1
+#ifndef USERTREEWIDGET_H
2
+#define USERTREEWIDGET_H
3
+
4
+#include <QTreeWidget>
5
+#include <QHeaderView>
6
+#include <QVariant>
7
+#include "netsoul.h"
8
+
9
+class UserTreeWidget : public QTreeWidget
10
+{
11
+    Q_OBJECT
12
+public:
13
+    explicit UserTreeWidget(QWidget *parent = 0);
14
+    NetSoul::User getSelectedUser();
15
+    NetSoul::Users getSelectedUsers();
16
+    
17
+signals:
18
+    void userSelected(NetSoul::User);
19
+    
20
+public slots:
21
+    void updateUser(NetSoul::User user);
22
+    void updateUsers(NetSoul::Users users);
23
+    void addUser(NetSoul::User user);
24
+    void addUsers(NetSoul::Users users);
25
+    void remove(QStringList logins);
26
+    void filter(QString text);
27
+    void resetUsers();
28
+
29
+private slots:
30
+    void itemDoubleClicked(QTreeWidgetItem* item,int);
31
+
32
+private:
33
+    bool itemContains(QTreeWidgetItem *item, QString text);
34
+    
35
+};
36
+
37
+#endif // USERTREEWIDGET_H

+ 11
- 0
ns_finder/main.cpp Ver arquivo

@@ -0,0 +1,11 @@
1
+#include "widget.h"
2
+#include <QApplication>
3
+
4
+int main(int argc, char *argv[])
5
+{
6
+    QApplication a(argc, argv);
7
+    Widget w;
8
+    w.show();
9
+    
10
+    return a.exec();
11
+}

+ 38
- 0
ns_finder/netsoullistusers.cpp Ver arquivo

@@ -0,0 +1,38 @@
1
+#include "netsoullistusers.h"
2
+
3
+NetSoulListUsers::NetSoulListUsers(QObject* parent) : QObject(parent)
4
+{
5
+    socket = new QTcpSocket(this);
6
+    connect(socket, SIGNAL(connected()), this, SLOT(connectedToNS()));
7
+    connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(sockError(QAbstractSocket::SocketError)));
8
+    connect(socket, SIGNAL(readyRead()), this, SLOT(readyRead()));
9
+}
10
+
11
+void NetSoulListUsers::list()
12
+{
13
+    socket->connectToHost("ns-server.epita.fr", 4242);
14
+}
15
+
16
+void NetSoulListUsers::connectedToNS()
17
+{
18
+    socket->write("list_users\n");
19
+}
20
+
21
+void NetSoulListUsers::sockError(QAbstractSocket::SocketError)
22
+{
23
+    emit NSError();
24
+}
25
+
26
+void NetSoulListUsers::readyRead()
27
+{
28
+    buf += QString(socket->readAll());
29
+    if(buf.endsWith("cmd end\n"))
30
+    {
31
+        QList<QList<QString> > users;
32
+        QStringList usrs = buf.split("\n", QString::SkipEmptyParts);
33
+        for(int i = 1; i < usrs.size() - 1; ++i)
34
+            users.append(usrs.at(i).split(" "));
35
+        socket->disconnectFromHost();
36
+        emit listed(users);
37
+    }
38
+}

+ 32
- 0
ns_finder/netsoullistusers.h Ver arquivo

@@ -0,0 +1,32 @@
1
+#ifndef NETSOULLISTUSERS_H
2
+#define NETSOULLISTUSERS_H
3
+
4
+#include <QObject>
5
+#include <QTcpSocket>
6
+#include <QList>
7
+#include <QStringList>
8
+
9
+class NetSoulListUsers : public QObject
10
+{
11
+    Q_OBJECT
12
+public:
13
+    NetSoulListUsers(QObject* parent);
14
+
15
+public slots:
16
+    void list();
17
+
18
+private slots:
19
+    void connectedToNS();
20
+    void sockError(QAbstractSocket::SocketError);
21
+    void readyRead();
22
+
23
+signals:
24
+    void listed(QList<QList<QString> >);
25
+    void NSError();
26
+
27
+private:
28
+    QTcpSocket* socket;
29
+    QString buf;
30
+};
31
+
32
+#endif // NETSOULLISTUSERS_H

+ 29
- 0
ns_finder/ns_finder.pro Ver arquivo

@@ -0,0 +1,29 @@
1
+#-------------------------------------------------
2
+#
3
+# Project created by QtCreator 2013-09-17T13:48:13
4
+#
5
+#-------------------------------------------------
6
+
7
+QT       += core gui network
8
+
9
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
10
+
11
+TARGET = loginfinder
12
+TEMPLATE = app
13
+
14
+
15
+SOURCES += main.cpp\
16
+        widget.cpp
17
+
18
+HEADERS  += widget.h
19
+
20
+FORMS    += widget.ui
21
+
22
+RC_FILE = rc.rc
23
+
24
+win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../Epimafia/release/ -lEpimafia
25
+else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../Epimafia/debug/ -lEpimafia
26
+else:unix: LIBS += -L$$OUT_PWD/../Epimafia/ -lEpimafia
27
+
28
+INCLUDEPATH += $$PWD/../Epimafia
29
+DEPENDPATH += $$PWD/../Epimafia

+ 245
- 0
ns_finder/ns_finder.pro.user Ver arquivo

@@ -0,0 +1,245 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE QtCreatorProject>
3
+<!-- Written by QtCreator 2.8.1, 2013-09-17T16:58:28. -->
4
+<qtcreator>
5
+ <data>
6
+  <variable>ProjectExplorer.Project.ActiveTarget</variable>
7
+  <value type="int">0</value>
8
+ </data>
9
+ <data>
10
+  <variable>ProjectExplorer.Project.EditorSettings</variable>
11
+  <valuemap type="QVariantMap">
12
+   <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
13
+   <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
14
+   <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
15
+   <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
16
+    <value type="QString" key="language">Cpp</value>
17
+    <valuemap type="QVariantMap" key="value">
18
+     <value type="QString" key="CurrentPreferences">CppGlobal</value>
19
+    </valuemap>
20
+   </valuemap>
21
+   <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
22
+    <value type="QString" key="language">QmlJS</value>
23
+    <valuemap type="QVariantMap" key="value">
24
+     <value type="QString" key="CurrentPreferences">QmlJSGlobal</value>
25
+    </valuemap>
26
+   </valuemap>
27
+   <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
28
+   <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
29
+   <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
30
+   <value type="int" key="EditorConfiguration.IndentSize">4</value>
31
+   <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
32
+   <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
33
+   <value type="int" key="EditorConfiguration.PaddingMode">1</value>
34
+   <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
35
+   <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
36
+   <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
37
+   <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
38
+   <value type="int" key="EditorConfiguration.TabSize">8</value>
39
+   <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
40
+   <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
41
+   <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
42
+   <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
43
+   <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
44
+   <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
45
+  </valuemap>
46
+ </data>
47
+ <data>
48
+  <variable>ProjectExplorer.Project.PluginSettings</variable>
49
+  <valuemap type="QVariantMap"/>
50
+ </data>
51
+ <data>
52
+  <variable>ProjectExplorer.Project.Target.0</variable>
53
+  <valuemap type="QVariantMap">
54
+   <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.1.1 MinGW 32bit</value>
55
+   <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.1.1 MinGW 32bit</value>
56
+   <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.511.win32_mingw48.essentials_kit</value>
57
+   <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
58
+   <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
59
+   <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
60
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
61
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
62
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
63
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
64
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
65
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
66
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
67
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
68
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
69
+      <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
70
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
71
+     </valuemap>
72
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
73
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
74
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
75
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
76
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
77
+      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
78
+      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
79
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
80
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
81
+     </valuemap>
82
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
83
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Compiler</value>
84
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
85
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
86
+    </valuemap>
87
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
88
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
89
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
90
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
91
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
92
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
93
+      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
94
+      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
95
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
96
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
97
+     </valuemap>
98
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
99
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Nettoyer</value>
100
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
101
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
102
+    </valuemap>
103
+    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
104
+    <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
105
+    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
106
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
107
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
108
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
109
+    <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
110
+    <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">D:/prog/C++/bin/ns_finder/</value>
111
+    <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
112
+   </valuemap>
113
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
114
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
115
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
116
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
117
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
118
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
119
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
120
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
121
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
122
+      <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
123
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
124
+     </valuemap>
125
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
126
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
127
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
128
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
129
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
130
+      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
131
+      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
132
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
133
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
134
+     </valuemap>
135
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
136
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Compiler</value>
137
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
138
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
139
+    </valuemap>
140
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
141
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
142
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
143
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
144
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
145
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
146
+      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
147
+      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
148
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
149
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
150
+     </valuemap>
151
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
152
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Nettoyer</value>
153
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
154
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
155
+    </valuemap>
156
+    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
157
+    <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
158
+    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
159
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
160
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
161
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
162
+    <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
163
+    <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">D:/prog/C++/bin/ns_finder/</value>
164
+    <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
165
+   </valuemap>
166
+   <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
167
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
168
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
169
+     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
170
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Déploiement</value>
171
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
172
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
173
+    </valuemap>
174
+    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
175
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Déployer localement</value>
176
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
177
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
178
+   </valuemap>
179
+   <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
180
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
181
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
182
+    <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
183
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
184
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
185
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
186
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
187
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
188
+    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
189
+    <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
190
+    <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
191
+    <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
192
+    <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
193
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
194
+    <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
195
+    <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
196
+    <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
197
+     <value type="int">0</value>
198
+     <value type="int">1</value>
199
+     <value type="int">2</value>
200
+     <value type="int">3</value>
201
+     <value type="int">4</value>
202
+     <value type="int">5</value>
203
+     <value type="int">6</value>
204
+     <value type="int">7</value>
205
+     <value type="int">8</value>
206
+     <value type="int">9</value>
207
+     <value type="int">10</value>
208
+     <value type="int">11</value>
209
+     <value type="int">12</value>
210
+     <value type="int">13</value>
211
+     <value type="int">14</value>
212
+    </valuelist>
213
+    <value type="int" key="PE.EnvironmentAspect.Base">2</value>
214
+    <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
215
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">ns_finder</value>
216
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
217
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/prog/C++/ns_finder/ns_finder.pro</value>
218
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
219
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">ns_finder.pro</value>
220
+    <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
221
+    <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
222
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
223
+    <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
224
+    <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
225
+    <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
226
+    <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
227
+    <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
228
+    <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
229
+   </valuemap>
230
+   <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
231
+  </valuemap>
232
+ </data>
233
+ <data>
234
+  <variable>ProjectExplorer.Project.TargetCount</variable>
235
+  <value type="int">1</value>
236
+ </data>
237
+ <data>
238
+  <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
239
+  <value type="QByteArray">{3074012e-28a1-4b99-a490-1fcbe7cc342f}</value>
240
+ </data>
241
+ <data>
242
+  <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
243
+  <value type="int">14</value>
244
+ </data>
245
+</qtcreator>

+ 1
- 0
ns_finder/rc.rc Ver arquivo

@@ -0,0 +1 @@
1
+IDI_ICON1               ICON    DISCARDABLE     "../Epimafia/icon.ico"

+ 130
- 0
ns_finder/widget.cpp Ver arquivo

@@ -0,0 +1,130 @@
1
+#include "widget.h"
2
+#include "ui_widget.h"
3
+
4
+Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
5
+{
6
+    ui->setupUi(this);
7
+    setFixedSize(size());
8
+    m_netsoul = new NetSoul(this);
9
+    if(qApp->arguments().size() == 3)
10
+    {
11
+        if(qApp->arguments().at(1) == "-login")
12
+        {
13
+            ui->lineLogin->setText(qApp->arguments().at(2));
14
+            on_lineLogin_returnPressed();
15
+        }
16
+        else if(qApp->arguments().at(1) == "-ip")
17
+        {
18
+            ui->lineIp->setText(qApp->arguments().at(2));
19
+            on_lineIp_returnPressed();
20
+        }
21
+    }
22
+}
23
+
24
+Widget::~Widget()
25
+{
26
+    delete ui;
27
+}
28
+
29
+void Widget::on_lineLogin_returnPressed()
30
+{
31
+    ui->lineIp->clear();
32
+    m_netsoul->disconnect(this);
33
+    connect(m_netsoul, SIGNAL(stateChanged(NetSoul::State)), this, SLOT(loginStateChanged(NetSoul::State)));
34
+    m_netsoul->login();
35
+    m_netsoul->listUsers(this, SLOT(loginList(NetSoul::Users)), ui->lineLogin->text());
36
+}
37
+
38
+void Widget::on_lineIp_returnPressed()
39
+{
40
+    ui->lineLogin->clear();
41
+    m_netsoul->disconnect(this);
42
+    connect(m_netsoul, SIGNAL(stateChanged(NetSoul::State)), this, SLOT(ipStateChanged(NetSoul::State)));
43
+    m_netsoul->login();
44
+    m_netsoul->listUsers(this, SLOT(ipList(NetSoul::Users)));
45
+}
46
+
47
+void Widget::ipList(NetSoul::Users users)
48
+{
49
+        QString res;
50
+        for(int i = 0; i < users.size(); ++i)
51
+        {
52
+            if(users.at(i).ip != ui->lineIp->text())
53
+                continue;
54
+            res += users.at(i).login + "; ";
55
+        }
56
+        res.remove(res.size() - 2, 2);
57
+        if(!res.isEmpty())
58
+            ui->lineLogin->setText(res);
59
+        else
60
+            ui->lineLogin->setText("#notFound#");
61
+    m_netsoul->logout();
62
+}
63
+
64
+void Widget::loginList(NetSoul::Users users)
65
+{
66
+    if(!users.isEmpty())
67
+    {
68
+        QString res;
69
+        for(int i = 0; i < users.size(); ++i)
70
+        {
71
+            res += users.at(i).ip;
72
+            if(i < users.size() - 1)
73
+                res += "; ";
74
+        }
75
+        ui->lineIp->setText(res);
76
+    }
77
+    else
78
+        ui->lineIp->setText("#notFound#");
79
+    m_netsoul->logout();
80
+}
81
+
82
+void Widget::ipStateChanged(NetSoul::State state)
83
+{
84
+    if(state == NetSoul::NetworkError || state == NetSoul::ProtocolError)
85
+        ui->lineLogin->setText("#error#");
86
+    setStatus(state);
87
+}
88
+
89
+void Widget::loginStateChanged(NetSoul::State state)
90
+{
91
+    if(state == NetSoul::NetworkError || state == NetSoul::ProtocolError)
92
+        ui->lineIp->setText("#error#");
93
+    setStatus(state);
94
+}
95
+
96
+void Widget::setStatus(NetSoul::State state)
97
+{
98
+    if(state == NetSoul::Disconnected)
99
+        ui->labelStatus->setText("idle");
100
+    else if(state == NetSoul::HostLookUp)
101
+        ui->labelStatus->setText("Searching Host...");
102
+    else if(state == NetSoul::Connecting)
103
+        ui->labelStatus->setText("Host Found. Connecting...");
104
+    else if(state == NetSoul::Connected || state == NetSoul::LoggedIn)
105
+        ui->labelStatus->setText("Connected. Searching...");
106
+    else if(state == NetSoul::Disconnecting)
107
+        ui->labelStatus->setText("Finished. Disconnecting...");
108
+    else if(state == NetSoul::NetworkError)
109
+        ui->labelStatus->setText("Network Error: " + QString::number((int)m_netsoul->getLastNetworkError()));
110
+    else if(state == NetSoul::ProtocolError)
111
+        ui->labelStatus->setText("Protocol Error");
112
+    else if(state == NetSoul::BadLogin)
113
+        ui->labelStatus->setText("Bad Login");
114
+    else
115
+        ui->labelStatus->setText("Illegal State");
116
+}
117
+
118
+void Widget::on_btnSearchLogin_clicked()
119
+{
120
+    QString logins = ui->lineLogin->text();
121
+    if(logins.isEmpty() || (logins.startsWith("#") && logins.endsWith("#")))
122
+        return;
123
+	QString exe;
124
+#ifdef Q_OS_WIN
125
+	exe = "intrabocal.exe";
126
+#else
127
+#error "OS specific"
128
+#endif
129
+	QProcess::startDetached(exe, QStringList() << "-logins" << logins);
130
+}

+ 39
- 0
ns_finder/widget.h Ver arquivo

@@ -0,0 +1,39 @@
1
+#ifndef WIDGET_H
2
+#define WIDGET_H
3
+
4
+#include <QWidget>
5
+#include <QProcess>
6
+#include <QDir>
7
+#include "netsoul.h"
8
+
9
+namespace Ui {
10
+class Widget;
11
+}
12
+
13
+class Widget : public QWidget
14
+{
15
+    Q_OBJECT
16
+    
17
+public:
18
+    explicit Widget(QWidget *parent = 0);
19
+    ~Widget();
20
+    
21
+private slots:
22
+    void on_lineLogin_returnPressed();
23
+
24
+    void on_lineIp_returnPressed();
25
+
26
+    void ipList(NetSoul::Users users);
27
+    void loginList(NetSoul::Users users);
28
+    void ipStateChanged(NetSoul::State state);
29
+    void loginStateChanged(NetSoul::State state);
30
+    void setStatus(NetSoul::State state);
31
+
32
+    void on_btnSearchLogin_clicked();
33
+
34
+private:
35
+    Ui::Widget *ui;
36
+    NetSoul* m_netsoul;
37
+};
38
+
39
+#endif // WIDGET_H

+ 160
- 0
ns_finder/widget.ui Ver arquivo

@@ -0,0 +1,160 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<ui version="4.0">
3
+ <class>Widget</class>
4
+ <widget class="QWidget" name="Widget">
5
+  <property name="geometry">
6
+   <rect>
7
+    <x>0</x>
8
+    <y>0</y>
9
+    <width>364</width>
10
+    <height>93</height>
11
+   </rect>
12
+  </property>
13
+  <property name="windowTitle">
14
+   <string>Login finder - Epimafia</string>
15
+  </property>
16
+  <property name="windowIcon">
17
+   <iconset>
18
+    <normaloff>:/icon.jpg</normaloff>:/icon.jpg</iconset>
19
+  </property>
20
+  <property name="styleSheet">
21
+   <string notr="true">QWidget
22
+{
23
+background-color: rgb(0, 0, 0);
24
+color: rgb(255, 255, 255);
25
+}
26
+QPushButton
27
+{
28
+border: 1px solid white;
29
+border-radius: 4px;
30
+}
31
+QPushButton:hover
32
+{
33
+	background-color:rgb(71, 71, 71);
34
+}
35
+QPushButton:pressed
36
+{
37
+	background-color:rgb(42, 42, 42);
38
+}
39
+QFrame, QToolTip
40
+{
41
+color: black;
42
+}
43
+QLabel
44
+{
45
+color: white;
46
+}</string>
47
+  </property>
48
+  <layout class="QHBoxLayout" name="horizontalLayout">
49
+   <item>
50
+    <widget class="QLabel" name="label_3">
51
+     <property name="sizePolicy">
52
+      <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
53
+       <horstretch>0</horstretch>
54
+       <verstretch>0</verstretch>
55
+      </sizepolicy>
56
+     </property>
57
+     <property name="minimumSize">
58
+      <size>
59
+       <width>150</width>
60
+       <height>75</height>
61
+      </size>
62
+     </property>
63
+     <property name="maximumSize">
64
+      <size>
65
+       <width>150</width>
66
+       <height>75</height>
67
+      </size>
68
+     </property>
69
+     <property name="text">
70
+      <string/>
71
+     </property>
72
+     <property name="pixmap">
73
+      <pixmap resource="../Epimafia/rc.qrc">:/epimafia/epimafia.jpg</pixmap>
74
+     </property>
75
+     <property name="scaledContents">
76
+      <bool>true</bool>
77
+     </property>
78
+    </widget>
79
+   </item>
80
+   <item>
81
+    <layout class="QVBoxLayout" name="verticalLayout">
82
+     <item>
83
+      <layout class="QFormLayout" name="formLayout">
84
+       <item row="0" column="0">
85
+        <widget class="QLabel" name="label">
86
+         <property name="text">
87
+          <string>Login:</string>
88
+         </property>
89
+        </widget>
90
+       </item>
91
+       <item row="1" column="0">
92
+        <widget class="QLabel" name="label_2">
93
+         <property name="text">
94
+          <string>IP:</string>
95
+         </property>
96
+        </widget>
97
+       </item>
98
+       <item row="1" column="1">
99
+        <widget class="QLineEdit" name="lineIp"/>
100
+       </item>
101
+       <item row="0" column="1">
102
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
103
+         <property name="spacing">
104
+          <number>2</number>
105
+         </property>
106
+         <item>
107
+          <widget class="QLineEdit" name="lineLogin"/>
108
+         </item>
109
+         <item>
110
+          <widget class="QPushButton" name="btnSearchLogin">
111
+           <property name="toolTip">
112
+            <string>Search on intra-bocal</string>
113
+           </property>
114
+           <property name="styleSheet">
115
+            <string notr="true"/>
116
+           </property>
117
+           <property name="text">
118
+            <string/>
119
+           </property>
120
+           <property name="icon">
121
+            <iconset resource="../Epimafia/rc.qrc">
122
+             <normaloff>:/epimafia/icon.png</normaloff>:/epimafia/icon.png</iconset>
123
+           </property>
124
+           <property name="iconSize">
125
+            <size>
126
+             <width>20</width>
127
+             <height>20</height>
128
+            </size>
129
+           </property>
130
+          </widget>
131
+         </item>
132
+        </layout>
133
+       </item>
134
+      </layout>
135
+     </item>
136
+     <item>
137
+      <widget class="QLabel" name="labelStatus">
138
+       <property name="text">
139
+        <string>idle</string>
140
+       </property>
141
+       <property name="alignment">
142
+        <set>Qt::AlignCenter</set>
143
+       </property>
144
+      </widget>
145
+     </item>
146
+    </layout>
147
+   </item>
148
+  </layout>
149
+ </widget>
150
+ <layoutdefault spacing="6" margin="11"/>
151
+ <tabstops>
152
+  <tabstop>lineLogin</tabstop>
153
+  <tabstop>lineIp</tabstop>
154
+  <tabstop>btnSearchLogin</tabstop>
155
+ </tabstops>
156
+ <resources>
157
+  <include location="../Epimafia/rc.qrc"/>
158
+ </resources>
159
+ <connections/>
160
+</ui>

+ 11
- 0
usermgr/main.cpp Ver arquivo

@@ -0,0 +1,11 @@
1
+#include "widget.h"
2
+#include <QApplication>
3
+
4
+int main(int argc, char *argv[])
5
+{
6
+    QApplication a(argc, argv);
7
+    Widget w;
8
+    w.show();
9
+    
10
+    return a.exec();
11
+}

+ 1
- 0
usermgr/rc.rc Ver arquivo

@@ -0,0 +1 @@
1
+IDI_ICON1               ICON    DISCARDABLE     "../Epimafia/icon.ico"

+ 30
- 0
usermgr/usermgr.pro Ver arquivo

@@ -0,0 +1,30 @@
1
+#-------------------------------------------------
2
+#
3
+# Project created by QtCreator 2013-09-21T18:37:07
4
+#
5
+#-------------------------------------------------
6
+
7
+QT       += core gui
8
+
9
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
10
+
11
+TARGET = usermgr
12
+TEMPLATE = app
13
+
14
+
15
+SOURCES += main.cpp\
16
+        widget.cpp
17
+
18
+HEADERS  += widget.h \
19
+    version.h
20
+
21
+FORMS    += widget.ui
22
+
23
+RC_FILE = rc.rc
24
+
25
+win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../Epimafia/release/ -lEpimafia
26
+else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../Epimafia/debug/ -lEpimafia
27
+else:unix: LIBS += -L$$OUT_PWD/../Epimafia/ -lEpimafia
28
+
29
+INCLUDEPATH += $$PWD/../Epimafia
30
+DEPENDPATH += $$PWD/../Epimafia

+ 21
- 0
usermgr/version.h Ver arquivo

@@ -0,0 +1,21 @@
1
+#ifndef VERSION_H
2
+#define VERSION_H
3
+
4
+#define VER_FILEVERSION             1,0,0,0
5
+#define VER_FILEVERSION_STR         "1.0.0.0\0"
6
+
7
+#define VER_PRODUCTVERSION          1,0,0,0
8
+#define VER_PRODUCTVERSION_STR      "1.0\0"
9
+
10
+#define VER_COMPANYNAME_STR         "Your Organization"
11
+#define VER_FILEDESCRIPTION_STR     "CoolApplication"
12
+#define VER_INTERNALNAME_STR        "CoolApplication"
13
+#define VER_LEGALCOPYRIGHT_STR      "Copyright © 2010 Your Organization"
14
+#define VER_LEGALTRADEMARKS1_STR    "All Rights Reserved"
15
+#define VER_LEGALTRADEMARKS2_STR    VER_LEGALTRADEMARKS1_STR
16
+#define VER_ORIGINALFILENAME_STR    "coolapplication.exe"
17
+#define VER_PRODUCTNAME_STR         "CoolApplication"
18
+
19
+#define VER_COMPANYDOMAIN_STR       "example.org"
20
+
21
+#endif // VERSION_H

+ 74
- 0
usermgr/widget.cpp Ver arquivo

@@ -0,0 +1,74 @@
1
+#include "widget.h"
2
+#include "ui_widget.h"
3
+
4
+Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
5
+{
6
+    ui->setupUi(this);
7
+	setFixedSize(size());
8
+    connect(ui->btnAdd, SIGNAL(clicked()), this, SLOT(addUser()));
9
+    connect(ui->btnRemove, SIGNAL(clicked()), this, SLOT(removeCurrent()));
10
+    connect(ui->btnSave, SIGNAL(clicked()), this, SLOT(saveCurrent()));
11
+    foreach(QLineEdit* line, findChildren<QLineEdit*>())
12
+        connect(line, SIGNAL(returnPressed()), this, SLOT(saveCurrent()));
13
+    load();
14
+}
15
+
16
+Widget::~Widget()
17
+{
18
+    delete ui;
19
+}
20
+
21
+void Widget::load()
22
+{
23
+    EpiUsers users = Epimafia::loadUsers();
24
+    foreach(EpiUser user, users)
25
+        ui->comboLogin->addItem(user.getLogin(), user.toVariant());
26
+    ui->btnRemove->setEnabled(users.size() != 0);
27
+}
28
+
29
+void Widget::removeCurrent()
30
+{
31
+    EpiUser usr = qvariant_cast<EpiUser>(ui->comboLogin->itemData(ui->comboLogin->currentIndex()));
32
+    Epimafia::removeUser(usr);
33
+    foreach(QLineEdit* line, findChildren<QLineEdit*>())
34
+        line->clear();
35
+    ui->comboLogin->removeItem(ui->comboLogin->currentIndex());
36
+    ui->btnRemove->setEnabled(ui->comboLogin->count() != 0);
37
+}
38
+
39
+void Widget::addUser()
40
+{
41
+    EpiUser usr;
42
+    usr.setLogin(Epimafia::getUnknownUser());
43
+    Epimafia::saveUser(usr);
44
+    ui->comboLogin->addItem(usr.getLogin(), usr.toVariant());
45
+    ui->comboLogin->setCurrentIndex(ui->comboLogin->count() - 1);
46
+    ui->btnRemove->setEnabled(true);
47
+}
48
+
49
+void Widget::saveCurrent()
50
+{
51
+    EpiUser usr = qvariant_cast<EpiUser>(ui->comboLogin->itemData(ui->comboLogin->currentIndex()));
52
+    usr.setLogin(ui->lineLogin->text());
53
+    usr.setPassword(ui->linePass->text());
54
+    usr.setPwd_num(ui->linePwdNum->text());
55
+    usr.setPwd_ppp(ui->linePwdPPP->text());
56
+    usr.setPwd_socks(ui->linePwdSocks->text());
57
+    ui->comboLogin->setItemData(ui->comboLogin->currentIndex(), usr.toVariant());
58
+    ui->comboLogin->setItemText(ui->comboLogin->currentIndex(), ui->lineLogin->text());
59
+    Epimafia::saveUser(usr);
60
+}
61
+
62
+void Widget::setUser(EpiUser user)
63
+{
64
+    ui->lineLogin->setText(user.getLogin());
65
+    ui->linePass->setText(user.getPassword());
66
+    ui->linePwdNum->setText(user.getPwd_num());
67
+    ui->linePwdPPP->setText(user.getPwd_ppp());
68
+    ui->linePwdSocks->setText(user.getPwd_socks());
69
+}
70
+
71
+void Widget::on_comboLogin_currentIndexChanged(int index)
72
+{
73
+    setUser(qvariant_cast<EpiUser>(ui->comboLogin->itemData(index)));
74
+}

+ 33
- 0
usermgr/widget.h Ver arquivo

@@ -0,0 +1,33 @@
1
+#ifndef WIDGET_H
2
+#define WIDGET_H
3
+
4
+#include <QWidget>
5
+#include "epimafia.h"
6
+
7
+namespace Ui {
8
+class Widget;
9
+}
10
+
11
+class Widget : public QWidget
12
+{
13
+    Q_OBJECT
14
+    
15
+public:
16
+    explicit Widget(QWidget *parent = 0);
17
+    ~Widget();
18
+
19
+public slots:
20
+    void load();
21
+    void removeCurrent();
22
+    void addUser();
23
+    void saveCurrent();
24
+    void setUser(EpiUser user);
25
+    
26
+private slots:
27
+    void on_comboLogin_currentIndexChanged(int index);
28
+
29
+private:
30
+    Ui::Widget *ui;
31
+};
32
+
33
+#endif // WIDGET_H

+ 26
- 0
usermgr/widget.h~ Ver arquivo

@@ -0,0 +1,26 @@
1
+#ifndef WIDGET_H
2
+#define WIDGET_H
3
+
4
+#include <QWidget>
5
+#include "epimafia.h"
6
+
7
+namespace Ui {
8
+class Widget;
9
+}
10
+
11
+class Widget : public QWidget
12
+{
13
+    Q_OBJECT
14
+    
15
+public:
16
+    explicit Widget(QWidget *parent = 0);
17
+    ~Widget();
18
+
19
+public slots:
20
+    void load();
21
+    
22
+private:
23
+    Ui::Widget *ui;
24
+};
25
+
26
+#endif // WIDGET_H

+ 359
- 0
usermgr/widget.ui Ver arquivo

@@ -0,0 +1,359 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<ui version="4.0">
3
+ <class>Widget</class>
4
+ <widget class="QWidget" name="Widget">
5
+  <property name="geometry">
6
+   <rect>
7
+    <x>0</x>
8
+    <y>0</y>
9
+    <width>238</width>
10
+    <height>317</height>
11
+   </rect>
12
+  </property>
13
+  <property name="windowTitle">
14
+   <string>User Manager - Epimafia</string>
15
+  </property>
16
+  <property name="windowIcon">
17
+   <iconset resource="../Epimafia/rc.qrc">
18
+    <normaloff>:/epimafia/icon.jpg</normaloff>:/epimafia/icon.jpg</iconset>
19
+  </property>
20
+  <property name="styleSheet">
21
+   <string notr="true">QWidget
22
+{
23
+background-color: rgb(0, 0, 0);
24
+color: rgb(255, 255, 255);
25
+}
26
+QPushButton
27
+{
28
+border: 1px solid white;
29
+border-radius: 4px;
30
+}
31
+QPushButton:hover
32
+{
33
+	background-color:rgb(71, 71, 71);
34
+}
35
+QPushButton:pressed
36
+{
37
+	background-color:rgb(42, 42, 42);
38
+}
39
+QFrame, QToolTip
40
+{
41
+color: black;
42
+}
43
+QLabel
44
+{
45
+color: white;
46
+}</string>
47
+  </property>
48
+  <layout class="QVBoxLayout" name="verticalLayout">
49
+   <item>
50
+    <layout class="QHBoxLayout" name="horizontalLayout">
51
+     <item>
52
+      <spacer name="horizontalSpacer">
53
+       <property name="orientation">
54
+        <enum>Qt::Horizontal</enum>
55
+       </property>
56
+       <property name="sizeHint" stdset="0">
57
+        <size>
58
+         <width>40</width>
59
+         <height>20</height>
60
+        </size>
61
+       </property>
62
+      </spacer>
63
+     </item>
64
+     <item>
65
+      <widget class="QLabel" name="label_7">
66
+       <property name="sizePolicy">
67
+        <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
68
+         <horstretch>0</horstretch>
69
+         <verstretch>0</verstretch>
70
+        </sizepolicy>
71
+       </property>
72
+       <property name="minimumSize">
73
+        <size>
74
+         <width>150</width>
75
+         <height>75</height>
76
+        </size>
77
+       </property>
78
+       <property name="maximumSize">
79
+        <size>
80
+         <width>150</width>
81
+         <height>75</height>
82
+        </size>
83
+       </property>
84
+       <property name="text">
85
+        <string/>
86
+       </property>
87
+       <property name="pixmap">
88
+        <pixmap resource="../Epimafia/rc.qrc">:/epimafia/epimafia.jpg</pixmap>
89
+       </property>
90
+       <property name="scaledContents">
91
+        <bool>true</bool>
92
+       </property>
93
+      </widget>
94
+     </item>
95
+     <item>
96
+      <spacer name="horizontalSpacer_2">
97
+       <property name="orientation">
98
+        <enum>Qt::Horizontal</enum>
99
+       </property>
100
+       <property name="sizeHint" stdset="0">
101
+        <size>
102
+         <width>40</width>
103
+         <height>20</height>
104
+        </size>
105
+       </property>
106
+      </spacer>
107
+     </item>
108
+    </layout>
109
+   </item>
110
+   <item>
111
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
112
+     <item>
113
+      <spacer name="horizontalSpacer_3">
114
+       <property name="orientation">
115
+        <enum>Qt::Horizontal</enum>
116
+       </property>
117
+       <property name="sizeHint" stdset="0">
118
+        <size>
119
+         <width>40</width>
120
+         <height>20</height>
121
+        </size>
122
+       </property>
123
+      </spacer>
124
+     </item>
125
+     <item>
126
+      <widget class="QComboBox" name="comboLogin">
127
+       <property name="minimumSize">
128
+        <size>
129
+         <width>100</width>
130
+         <height>20</height>
131
+        </size>
132
+       </property>
133
+       <property name="styleSheet">
134
+        <string notr="true">QWidget
135
+{
136
+border: 1px solid white;
137
+border-radius: 1px;
138
+}
139
+QFrame, QToolTip
140
+{
141
+color: white;
142
+}</string>
143
+       </property>
144
+      </widget>
145
+     </item>
146
+     <item>
147
+      <spacer name="horizontalSpacer_4">
148
+       <property name="orientation">
149
+        <enum>Qt::Horizontal</enum>
150
+       </property>
151
+       <property name="sizeHint" stdset="0">
152
+        <size>
153
+         <width>40</width>
154
+         <height>20</height>
155
+        </size>
156
+       </property>
157
+      </spacer>
158
+     </item>
159
+    </layout>
160
+   </item>
161
+   <item>
162
+    <layout class="QHBoxLayout" name="horizontalLayout_3">
163
+     <item>
164
+      <spacer name="horizontalSpacer_5">
165
+       <property name="orientation">
166
+        <enum>Qt::Horizontal</enum>
167
+       </property>
168
+       <property name="sizeHint" stdset="0">
169
+        <size>
170
+         <width>40</width>
171
+         <height>20</height>
172
+        </size>
173
+       </property>
174
+      </spacer>
175
+     </item>
176
+     <item>
177
+      <widget class="QPushButton" name="btnRemove">
178
+       <property name="enabled">
179
+        <bool>false</bool>
180
+       </property>
181
+       <property name="minimumSize">
182
+        <size>
183
+         <width>20</width>
184
+         <height>20</height>
185
+        </size>
186
+       </property>
187
+       <property name="toolTip">
188
+        <string>Remove user</string>
189
+       </property>
190
+       <property name="text">
191
+        <string>-</string>
192
+       </property>
193
+      </widget>
194
+     </item>
195
+     <item>
196
+      <widget class="QPushButton" name="btnAdd">
197
+       <property name="minimumSize">
198
+        <size>
199
+         <width>20</width>
200
+         <height>20</height>
201
+        </size>
202
+       </property>
203
+       <property name="toolTip">
204
+        <string>Add user</string>
205
+       </property>
206
+       <property name="text">
207
+        <string>+</string>
208
+       </property>
209
+      </widget>
210
+     </item>
211
+     <item>
212
+      <spacer name="horizontalSpacer_6">
213
+       <property name="orientation">
214
+        <enum>Qt::Horizontal</enum>
215
+       </property>
216
+       <property name="sizeHint" stdset="0">
217
+        <size>
218
+         <width>40</width>
219
+         <height>20</height>
220
+        </size>
221
+       </property>
222
+      </spacer>
223
+     </item>
224
+    </layout>
225
+   </item>
226
+   <item>
227
+    <layout class="QFormLayout" name="formLayout">
228
+     <property name="fieldGrowthPolicy">
229
+      <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
230
+     </property>
231
+     <item row="0" column="0">
232
+      <widget class="QLabel" name="label_2">
233
+       <property name="text">
234
+        <string>Login:</string>
235
+       </property>
236
+      </widget>
237
+     </item>
238
+     <item row="0" column="1">
239
+      <widget class="QLineEdit" name="lineLogin">
240
+       <property name="text">
241
+        <string/>
242
+       </property>
243
+      </widget>
244
+     </item>
245
+     <item row="1" column="0">
246
+      <widget class="QLabel" name="label_3">
247
+       <property name="text">
248
+        <string>Password:</string>
249
+       </property>
250
+      </widget>
251
+     </item>
252
+     <item row="1" column="1">
253
+      <widget class="QLineEdit" name="linePass">
254
+       <property name="echoMode">
255
+        <enum>QLineEdit::Password</enum>
256
+       </property>
257
+      </widget>
258
+     </item>
259
+     <item row="2" column="0">
260
+      <widget class="QLabel" name="label_4">
261
+       <property name="text">
262
+        <string>Password Num:</string>
263
+       </property>
264
+      </widget>
265
+     </item>
266
+     <item row="2" column="1">
267
+      <widget class="QLineEdit" name="linePwdNum">
268
+       <property name="echoMode">
269
+        <enum>QLineEdit::Password</enum>
270
+       </property>
271
+      </widget>
272
+     </item>
273
+     <item row="3" column="0">
274
+      <widget class="QLabel" name="label_5">
275
+       <property name="text">
276
+        <string>Password PPP:</string>
277
+       </property>
278
+      </widget>
279
+     </item>
280
+     <item row="3" column="1">
281
+      <widget class="QLineEdit" name="linePwdPPP">
282
+       <property name="echoMode">
283
+        <enum>QLineEdit::Password</enum>
284
+       </property>
285
+      </widget>
286
+     </item>
287
+     <item row="4" column="0">
288
+      <widget class="QLabel" name="label_6">
289
+       <property name="text">
290
+        <string>Password Socks:</string>
291
+       </property>
292
+      </widget>
293
+     </item>
294
+     <item row="4" column="1">
295
+      <widget class="QLineEdit" name="linePwdSocks">
296
+       <property name="echoMode">
297
+        <enum>QLineEdit::Password</enum>
298
+       </property>
299
+      </widget>
300
+     </item>
301
+     <item row="5" column="1">
302
+      <layout class="QHBoxLayout" name="horizontalLayout_4">
303
+       <item>
304
+        <spacer name="horizontalSpacer_7">
305
+         <property name="orientation">
306
+          <enum>Qt::Horizontal</enum>
307
+         </property>
308
+         <property name="sizeHint" stdset="0">
309
+          <size>
310
+           <width>40</width>
311
+           <height>20</height>
312
+          </size>
313
+         </property>
314
+        </spacer>
315
+       </item>
316
+       <item>
317
+        <widget class="QPushButton" name="btnSave">
318
+         <property name="sizePolicy">
319
+          <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
320
+           <horstretch>0</horstretch>
321
+           <verstretch>0</verstretch>
322
+          </sizepolicy>
323
+         </property>
324
+         <property name="minimumSize">
325
+          <size>
326
+           <width>50</width>
327
+           <height>20</height>
328
+          </size>
329
+         </property>
330
+         <property name="text">
331
+          <string>Save</string>
332
+         </property>
333
+        </widget>
334
+       </item>
335
+      </layout>
336
+     </item>
337
+    </layout>
338
+   </item>
339
+   <item>
340
+    <spacer name="verticalSpacer">
341
+     <property name="orientation">
342
+      <enum>Qt::Vertical</enum>
343
+     </property>
344
+     <property name="sizeHint" stdset="0">
345
+      <size>
346
+       <width>20</width>
347
+       <height>40</height>
348
+      </size>
349
+     </property>
350
+    </spacer>
351
+   </item>
352
+  </layout>
353
+ </widget>
354
+ <layoutdefault spacing="6" margin="11"/>
355
+ <resources>
356
+  <include location="../Epimafia/rc.qrc"/>
357
+ </resources>
358
+ <connections/>
359
+</ui>

Carregando…
Cancelar
Salvar