Qt 6.x
The Qt SDK
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
37};
38
40
41class QDBusObjectPath;
42
43// This tiny class exists for the purpose of seeing if NetworkManager is available without
44// initializing everything the derived/full class needs.
46{
48public:
51
52 static bool networkManagerAvailable();
53
54private:
55 Q_DISABLE_COPY_MOVE(QNetworkManagerInterfaceBase)
56};
57
59{
61
62public:
63 // Matches 'NMState' from https://developer.gnome.org/NetworkManager/stable/nm-dbus-types.html
64 enum NMState {
73 };
75 // Matches 'NMConnectivityState' from
76 // https://developer.gnome.org/NetworkManager/stable/nm-dbus-types.html#NMConnectivityState
83 };
85 // Matches 'NMDeviceType' from
86 // https://developer-old.gnome.org/NetworkManager/stable/nm-dbus-types.html#NMDeviceType
120 };
121 // Matches 'NMMetered' from
122 // https://developer-old.gnome.org/NetworkManager/stable/nm-dbus-types.html#NMMetered
129 };
130
133
134 NMState state() const;
136 NMDeviceType deviceType() const;
137 NMMetered meteredState() const;
138
144
145private Q_SLOTS:
146 void setProperties(const QString &interfaceName, const QMap<QString, QVariant> &map,
147 const QStringList &invalidatedProperties);
148
149private:
150 Q_DISABLE_COPY_MOVE(QNetworkManagerInterface)
151
152 NMDeviceType extractDeviceType(const QDBusObjectPath &devicePath) const;
153 NMMetered extractDeviceMetered(const QDBusObjectPath &devicePath) const;
154
155 std::optional<QDBusObjectPath> primaryConnectionDevicePath() const;
156
157 QVariantMap propertyMap;
158};
159
161{
162public:
164 const QDBusConnection &connection, QObject *parent = nullptr)
166 {
167 }
168};
169
171
172#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.
\inmodule QtDBus
\inmodule QtDBus
Definition qmap.h:186
void stateChanged(NMState)
NMConnectivityState connectivityState() const
void meteredChanged(NMMetered)
void connectivityChanged(NMConnectivityState)
Q_ENUM(NMConnectivityState)
void deviceTypeChanged(NMDeviceType)
\inmodule QtCore
Definition qobject.h:90
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:311
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
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
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent