2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-08-30 23:23:35 -07:00
|
|
|
|
|
|
|
#ifndef NSQTNETWORKMANAGER_H_
|
|
|
|
#define NSQTNETWORKMANAGER_H_
|
|
|
|
|
2011-04-08 01:32:00 -07:00
|
|
|
#include <QNetworkConfigurationManager>
|
|
|
|
#include <QObject>
|
|
|
|
#include <QTimer>
|
|
|
|
#include <QNetworkConfiguration>
|
|
|
|
#include <QNetworkSession>
|
2010-08-30 23:23:35 -07:00
|
|
|
#include "nscore.h"
|
|
|
|
|
2011-04-08 01:32:00 -07:00
|
|
|
class nsQtNetworkManager;
|
|
|
|
|
2011-05-07 01:27:13 -07:00
|
|
|
|
2011-04-08 01:32:00 -07:00
|
|
|
|
|
|
|
class nsQtNetworkManager : public QObject
|
2010-08-30 23:23:35 -07:00
|
|
|
{
|
2011-04-08 01:32:00 -07:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2011-05-07 01:27:13 -07:00
|
|
|
static void create();
|
|
|
|
static void destroy();
|
2011-04-08 01:32:00 -07:00
|
|
|
virtual ~nsQtNetworkManager();
|
2010-08-30 23:23:35 -07:00
|
|
|
|
2011-05-07 01:27:13 -07:00
|
|
|
static nsQtNetworkManager* get() { return gQtNetworkManager; }
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool IsConnected();
|
|
|
|
static bool GetLinkStatusKnown();
|
2011-04-08 01:32:00 -07:00
|
|
|
static void enableInstance();
|
2011-09-28 23:19:26 -07:00
|
|
|
bool openConnection(const QString&);
|
|
|
|
bool isOnline();
|
2013-01-11 15:06:36 -08:00
|
|
|
Q_SIGNALS:
|
2011-04-08 01:32:00 -07:00
|
|
|
void openConnectionSignal();
|
2010-08-30 23:23:35 -07:00
|
|
|
|
2013-01-11 15:06:36 -08:00
|
|
|
public Q_SLOTS:
|
2011-04-08 01:32:00 -07:00
|
|
|
void closeSession();
|
|
|
|
void onlineStateChanged(bool);
|
|
|
|
|
2013-01-11 15:06:36 -08:00
|
|
|
private Q_SLOTS:
|
2011-04-08 01:32:00 -07:00
|
|
|
void openSession();
|
|
|
|
|
|
|
|
private:
|
2011-05-07 01:27:13 -07:00
|
|
|
explicit nsQtNetworkManager(QObject* parent = 0);
|
|
|
|
|
|
|
|
static nsQtNetworkManager* gQtNetworkManager;
|
2011-04-08 01:32:00 -07:00
|
|
|
QNetworkSession* networkSession;
|
|
|
|
QNetworkConfiguration networkConfiguration;
|
|
|
|
QNetworkConfigurationManager networkConfigurationManager;
|
|
|
|
QTimer mBlockTimer;
|
|
|
|
bool mOnline;
|
2010-08-30 23:23:35 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* NSQTNETWORKMANAGER_H_ */
|
2011-04-08 01:32:00 -07:00
|
|
|
|