|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 #ifndef NSQTNETWORKMANAGER_H_ |
|
6 #define NSQTNETWORKMANAGER_H_ |
|
7 |
|
8 #include <QNetworkConfigurationManager> |
|
9 #include <QObject> |
|
10 #include <QTimer> |
|
11 #include <QNetworkConfiguration> |
|
12 #include <QNetworkSession> |
|
13 #include "nscore.h" |
|
14 |
|
15 class nsQtNetworkManager; |
|
16 |
|
17 |
|
18 |
|
19 class nsQtNetworkManager : public QObject |
|
20 { |
|
21 Q_OBJECT |
|
22 public: |
|
23 static void create(); |
|
24 static void destroy(); |
|
25 virtual ~nsQtNetworkManager(); |
|
26 |
|
27 static nsQtNetworkManager* get() { return gQtNetworkManager; } |
|
28 |
|
29 static bool IsConnected(); |
|
30 static bool GetLinkStatusKnown(); |
|
31 static void enableInstance(); |
|
32 bool openConnection(const QString&); |
|
33 bool isOnline(); |
|
34 Q_SIGNALS: |
|
35 void openConnectionSignal(); |
|
36 |
|
37 public Q_SLOTS: |
|
38 void closeSession(); |
|
39 void onlineStateChanged(bool); |
|
40 |
|
41 private Q_SLOTS: |
|
42 void openSession(); |
|
43 |
|
44 private: |
|
45 explicit nsQtNetworkManager(QObject* parent = 0); |
|
46 |
|
47 static nsQtNetworkManager* gQtNetworkManager; |
|
48 QNetworkSession* networkSession; |
|
49 QNetworkConfiguration networkConfiguration; |
|
50 QNetworkConfigurationManager networkConfigurationManager; |
|
51 QTimer mBlockTimer; |
|
52 bool mOnline; |
|
53 }; |
|
54 |
|
55 #endif /* NSQTNETWORKMANAGER_H_ */ |
|
56 |