Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qnetworkmanagerservice.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 QNETWORKMANAGERSERVICE_H
5#define QNETWORKMANAGERSERVICE_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/qvariant.h>
19#include <QtCore/qmap.h>
20#include <QtDBus/qdbusabstractinterface.h>
21
22#include <optional>
23
24// Matches 'NMDeviceState' from https://developer.gnome.org/NetworkManager/stable/nm-dbus-types.html
38
39QT_BEGIN_NAMESPACE
40
41class QDBusObjectPath;
43
44// This tiny class exists for the purpose of seeing if NetworkManager is available without
45// initializing everything the derived/full class needs.
58
60{
62
63public:
64 // Matches 'NMState' from https://developer.gnome.org/NetworkManager/stable/nm-dbus-types.html
75 Q_ENUM(NMState)
76 // Matches 'NMConnectivityState' from
77 // https://developer.gnome.org/NetworkManager/stable/nm-dbus-types.html#NMConnectivityState
85 Q_ENUM(NMConnectivityState)
86 // Matches 'NMDeviceType' from
87 // https://developer-old.gnome.org/NetworkManager/stable/nm-dbus-types.html#NMDeviceType
122 // Matches 'NMMetered' from
123 // https://developer-old.gnome.org/NetworkManager/stable/nm-dbus-types.html#NMMetered
131
132 explicit QNetworkManagerInterface(QObject *parent = nullptr);
134
136
137 NMState state() const;
139 NMDeviceType deviceType() const;
140 NMMetered meteredState() const;
141
142 bool isValid() const { return QDBusAbstractInterface::isValid() && validDBusConnection; }
143
144private Q_SLOTS:
147
148private:
150
152 NMMetered extractDeviceMetered(const QDBusObjectPath &devicePath) const;
153
154 std::optional<QDBusObjectPath> primaryConnectionDevicePath() const;
155
156 QVariantMap propertyMap;
158 bool validDBusConnection = true;
159};
160
162{
163public:
164 PropertiesDBusInterface(const QString &service, const QString &path, const QString &interface,
165 const QDBusConnection &connection, QObject *parent = nullptr)
167 {
168 }
169};
170
171QT_END_NAMESPACE
172
173#endif
PropertiesDBusInterface(const QString &service, const QString &path, const QString &interface, const QDBusConnection &connection, QObject *parent=nullptr)
void setBackend(QNetworkManagerNetworkInformationBackend *ourBackend)
NMConnectivityState connectivityState() const
QNetworkManagerInterface(QObject *parent=nullptr)
QString name() const override
Backend name, return the same in QNetworkInformationBackend::name().
QNetworkInformationBackend * create(QNetworkInformation::Features requiredFeatures) const override
Create and return an instance of QNetworkInformationBackend.
QNetworkInformation::Features featuresSupported() const override
Features supported, return the same in QNetworkInformationBackend::featuresSupported().
void onStateChanged(QNetworkManagerInterface::NMState state)
QString name() const override
Backend name, return the same in QNetworkInformationBackendFactory::name().
void onMeteredChanged(QNetworkManagerInterface::NMMetered metered)
void onConnectivityChanged(QNetworkManagerInterface::NMConnectivityState connectivityState)
void onDeviceTypeChanged(QNetworkManagerInterface::NMDeviceType deviceType)
QNetworkInformation::Features featuresSupported() const override
Features supported, return the same in QNetworkInformationBackendFactory::featuresSupported().
Combined button and popup list for selecting options.
static QString backendName()
@ NM_DEVICE_STATE_ACTIVATED
@ NM_DEVICE_STATE_UNMANAGED
@ NM_DEVICE_STATE_FAILED
@ NM_DEVICE_STATE_IP_CONFIG
@ NM_DEVICE_STATE_PREPARE
@ NM_DEVICE_STATE_DEACTIVATING
@ NM_DEVICE_STATE_CONFIG
@ NM_DEVICE_STATE_UNAVAILABLE
@ NM_DEVICE_STATE_NEED_AUTH
@ NM_DEVICE_STATE_DISCONNECTED
@ NM_DEVICE_STATE_UNKNOWN