Implémentation détection internet
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#ifndef INTERNETMONITOR_H
|
||||
#define INTERNETMONITOR_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QTimer>
|
||||
|
||||
#define INTERNET_MONITOR_CONNECTION_TIMEOUT 2000
|
||||
#define INTERNET_MONITOR_INET_CHECK_TIMEOUT 5000
|
||||
|
||||
class CInternetMonitor : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CInternetMonitor(QObject *parent = 0);
|
||||
~CInternetMonitor();
|
||||
int Start();
|
||||
bool IsInternetActive();
|
||||
|
||||
private:
|
||||
QNetworkAccessManager *mNetMgr;
|
||||
bool mInternetActive;
|
||||
QTimer *mCheckInternetStateTimer, *mConnectionTimer;
|
||||
|
||||
int CheckInternet();
|
||||
|
||||
signals:
|
||||
|
||||
void InternetStateChanged(bool);
|
||||
|
||||
public slots:
|
||||
void NetworkReqfinished(QNetworkReply *reply);
|
||||
void CheckInternetTimerExpired();
|
||||
void ConnectionTimerExpired();
|
||||
};
|
||||
|
||||
#endif // INTERNETMONITOR_H
|
||||
Reference in New Issue
Block a user