1
1
#include < QNetworkInformation>
2
2
#include " libserver.h"
3
+ <<<<<<< HEAD
3
4
#include " network.h"
5
+ =======
6
+ >>>>>>> b8afb2139 (frontend/qt: react to change in connectivity status.)
4
7
5
8
void setupReachabilityNotifier() {
6
9
auto loaded = QNetworkInformation::loadBackendByFeatures (QNetworkInformation::Feature::Reachability);
7
10
if (!loaded) {
11
+ <<<<<<< HEAD
8
12
goLog (" can't load QNetworkInformation backend" );
9
13
// If we can't load the backend, we can't determine whether or not to show the banner.
10
14
setOnline (true );
15
+ =======
16
+ >>>>>>> b8afb2139 (frontend/qt: react to change in connectivity status.)
11
17
return ;
12
18
}
13
19
QNetworkInformation* info = QNetworkInformation::instance ();
14
20
if (info) {
15
21
QObject::connect (info, &QNetworkInformation::reachabilityChanged, [](QNetworkInformation::Reachability reachability){
22
+ <<<<<<< HEAD
16
23
// We include Reachability::Unknown here as we prefer not include false positives. If QT can't determine whether
17
24
// we are online, we do not show the banner.
18
25
bool isReachable = (reachability == QNetworkInformation::Reachability::Online || reachability == QNetworkInformation::Reachability::Unknown);
19
26
setOnline (isReachable);
27
+ =======
28
+ bool isReachable = (reachability == QNetworkInformation::Reachability::Online);
29
+ onlineStatusChanged (isReachable);
30
+ >>>>>>> b8afb2139 (frontend/qt: react to change in connectivity status.)
20
31
});
21
32
}
22
33
}
23
34
24
35
bool isReachable () {
25
36
auto loaded = QNetworkInformation::loadBackendByFeatures (QNetworkInformation::Feature::Reachability);
26
37
if (!loaded) {
38
+ <<<<<<< HEAD
27
39
goLog (" can't load QNetworkInformation backend" );
28
40
return true ;
29
41
}
@@ -33,4 +45,14 @@ bool isReachable() {
33
45
}
34
46
// Same as above, if we can't obtain information, we don't show any banner at all.
35
47
return true ;
48
+ =======
49
+ return false ;
50
+ }
51
+ QNetworkInformation* info = QNetworkInformation::instance();
52
+ if (info) {
53
+ return info->reachability () == QNetworkInformation::Reachability::Online;
54
+ } else {
55
+ return false ;
56
+ }
57
+ >>>>>>> b8afb2139 (frontend/qt: react to change in connectivity status.)
36
58
}
0 commit comments