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
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
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.
47{
49public:
50 explicit QNetworkManagerInterfaceBase(QObject *parent = nullptr);
52
53 static bool networkManagerAvailable();
54
55private:
56 Q_DISABLE_COPY_MOVE(QNetworkManagerInterfaceBase)
57};
58
60{
62
63public:
64 // Matches 'NMState' from https://developer.gnome.org/NetworkManager/stable/nm-dbus-types.html
76 // Matches 'NMConnectivityState' from
77 // https://developer.gnome.org/NetworkManager/stable/nm-dbus-types.html#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:
145 void setProperties(const QString &interfaceName, const QMap<QString, QVariant> &map,
146 const QStringList &invalidatedProperties);
147
148private:
149 Q_DISABLE_COPY_MOVE(QNetworkManagerInterface)
150
151 NMDeviceType extractDeviceType(const QDBusObjectPath &devicePath) const;
152 NMMetered extractDeviceMetered(const QDBusObjectPath &devicePath) const;
153
154 std::optional<QDBusObjectPath> primaryConnectionDevicePath() const;
155
156 QVariantMap propertyMap;
158 bool validDBusConnection = true;
159};
160
170
172
173#endif
PropertiesDBusInterface(const QString &service, const QString &path, const QString &interface, const QDBusConnection &connection, QObject *parent=nullptr)
QString service() const
Returns the name of the service this interface is associated with.
QDBusConnection connection() const
Returns the connection this interface is associated with.
QString interface() const
Returns the name of this interface.
bool isValid() const
Returns true if this is a valid reference to a remote object.
\inmodule QtDBus
\inmodule QtDBus
QNetworkManagerInterfaceBase(QObject *parent=nullptr)
void setBackend(QNetworkManagerNetworkInformationBackend *ourBackend)
NMConnectivityState connectivityState() const
QNetworkManagerInterface(QObject *parent=nullptr)
Q_ENUM(NMConnectivityState)
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
QMap< QString, QString > map
[6]
Combined button and popup list for selecting options.
@ 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
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLsizei const GLchar *const * path
QAnyStringView interfaceName(const Interface &iface)
#define Q_OBJECT
#define Q_SLOTS