Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qnetworklistmanagerevents.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QNETWORKLISTMANAGEREVENTS_H
5#define QNETWORKLISTMANAGEREVENTS_H
6
7#include <QtNetwork/private/qtnetworkglobal_p.h>
8
9#include <QtNetwork/qnetworkinformation.h>
10
11#include <QtCore/qstring.h>
12#include <QtCore/qobject.h>
13#include <QtCore/qloggingcategory.h>
14#include <QtCore/qmutex.h>
15
16#include <objbase.h>
17#include <ocidl.h>
18#include <netlistmgr.h>
19#include <wrl/client.h>
20#include <wrl/wrappers/corewrappers.h>
21
22#if QT_CONFIG(cpp_winrt)
23#include <QtCore/private/qt_winrtbase_p.h>
24#endif
25
26using namespace Microsoft::WRL;
27
30
31class QNetworkListManagerEvents : public QObject, public INetworkListManagerEvents
32{
34public:
37
38 HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject) override;
39
40 ULONG STDMETHODCALLTYPE AddRef() override { return ++ref; }
41 ULONG STDMETHODCALLTYPE Release() override
42 {
43 if (--ref == 0) {
44 delete this;
45 return 0;
46 }
47 return ref;
48 }
49
50 HRESULT STDMETHODCALLTYPE ConnectivityChanged(NLM_CONNECTIVITY newConnectivity) override;
51
52 [[nodiscard]] bool start();
53 void stop();
54
55 [[nodiscard]] bool checkBehindCaptivePortal();
56
58 void connectivityChanged(NLM_CONNECTIVITY);
60 void isMeteredChanged(bool);
61
62private:
63 ComPtr<INetworkListManager> networkListManager = nullptr;
64 ComPtr<IConnectionPoint> connectionPoint = nullptr;
65
66#if QT_CONFIG(cpp_winrt)
67 void emitWinRTUpdates();
68
69 winrt::event_token token;
70 QMutex winrtLock;
71#endif
72
73 QAtomicInteger<ULONG> ref = 0;
74 DWORD cookie = 0;
75};
76
78
79#endif // QNETWORKLISTMANAGEREVENTS_H
\inmodule QtCore
Definition qmutex.h:281
ULONG STDMETHODCALLTYPE Release() override
void transportMediumChanged(QNetworkInformation::TransportMedium)
void connectivityChanged(NLM_CONNECTIVITY)
ULONG STDMETHODCALLTYPE AddRef() override
\inmodule QtCore
Definition qobject.h:103
Token token
Definition keywords.cpp:444
Combined button and popup list for selecting options.
#define Q_DECLARE_LOGGING_CATEGORY(name)
GLuint start
GLint ref
#define Q_OBJECT
#define signals
IUIViewSettingsInterop __RPC__in REFIID riid
long HRESULT