2020-08-03 13:27:42 -04:00
|
|
|
/*
|
2022-01-06 11:24:13 -05:00
|
|
|
* Copyright (C) 2019-2022 Savoir-faire Linux Inc.
|
2020-08-03 13:27:42 -04:00
|
|
|
* Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
#ifdef Q_OS_WIN
|
2020-09-17 16:08:52 -04:00
|
|
|
class ConnectivityMonitor final : public QObject
|
2020-08-03 13:27:42 -04:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2021-03-11 13:30:45 -05:00
|
|
|
explicit ConnectivityMonitor(QObject* parent = nullptr);
|
2020-08-03 13:27:42 -04:00
|
|
|
~ConnectivityMonitor();
|
|
|
|
|
|
|
|
bool isOnline();
|
|
|
|
|
2021-03-29 16:51:53 -04:00
|
|
|
Q_SIGNALS:
|
2020-08-03 13:27:42 -04:00
|
|
|
void connectivityChanged();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void destroy();
|
|
|
|
|
2020-09-10 17:40:51 -04:00
|
|
|
struct INetworkListManager* pNetworkListManager_;
|
|
|
|
struct IConnectionPointContainer* pCPContainer_;
|
|
|
|
struct IConnectionPoint* pConnectPoint_;
|
|
|
|
class NetworkEventHandler* netEventHandler_;
|
2020-08-03 13:27:42 -04:00
|
|
|
unsigned long cookie_;
|
|
|
|
};
|
2020-09-17 16:08:52 -04:00
|
|
|
|
|
|
|
#else
|
|
|
|
// TODO: platform implementations should be in the daemon.
|
|
|
|
|
|
|
|
class ConnectivityMonitor final : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2021-03-11 13:30:45 -05:00
|
|
|
explicit ConnectivityMonitor(QObject* parent = nullptr);
|
2020-12-07 16:19:43 +01:00
|
|
|
~ConnectivityMonitor();
|
|
|
|
|
|
|
|
bool isOnline();
|
2020-09-17 16:08:52 -04:00
|
|
|
|
2021-03-29 16:51:53 -04:00
|
|
|
Q_SIGNALS:
|
2020-09-17 16:08:52 -04:00
|
|
|
void connectivityChanged();
|
|
|
|
};
|
|
|
|
#endif // Q_OS_WIN
|