defuze.me
Client
|
00001 /************************************************************************** 00002 ** defuze.me Epitech Innovative Project 00003 ** 00004 ** Copyright 2010 00005 ** Athena Calmettes - Jocelyn De La Rosa - Francois Gaillard 00006 ** Adrien Jarthon - Alexandre Moore - Luc Peres - Arnaud Sellier 00007 ** 00008 ** All rights reserved. 00009 **************************************************************************/ 00010 00011 namespace Network { 00012 class Authenticator; 00013 } 00014 00015 #ifndef AUTHENTICATOR_HPP 00016 #define AUTHENTICATOR_HPP 00017 00018 #include <QString> 00019 #include "networkcore.hpp" 00020 #include "dbcore.hpp" 00021 #include "main.hpp" 00022 #include "parameterizable.hpp" 00023 00024 namespace Network 00025 { 00033 class Authenticator : public Params::Parameterizable 00034 { 00035 Q_OBJECT 00036 public: 00037 Authenticator(NetworkCore& net); 00038 ~Authenticator(); 00039 const QString getToken(); 00040 bool hasToken() const; 00041 QVariantMap getRadioInfo() const; 00042 00043 public slots: 00044 void authenticate(const QString& login, const QString& password); 00045 void cancel(); 00046 void invalidate(); 00047 00048 private slots: 00049 void receiveResponse(); 00050 00051 signals: 00052 void failed(const QString& message); 00053 void authenticated(); 00054 void needCredentials(const QString& login); 00055 00056 private: 00057 void defineParams(); 00058 00059 NetworkCore& network; 00060 QString password; 00061 QNetworkReply *reply; 00062 bool authenticating; 00063 }; 00064 } 00065 00066 #endif // AUTHENTICATOR_HPP