diff options
Diffstat (limited to 'src')
28 files changed, 1841 insertions, 131 deletions
diff --git a/src/bluetoothsettings/bluetoothdevice.cpp b/src/bluetoothsettings/bluetoothdevice.cpp index 442a31c..01de4bc 100644 --- a/src/bluetoothsettings/bluetoothdevice.cpp +++ b/src/bluetoothsettings/bluetoothdevice.cpp @@ -32,60 +32,128 @@ QT_BEGIN_NAMESPACE +/*! + \class BluetoothDevice + \inmodule QtDeviceUtilities + + \brief The BluetoothDevice class controls Bluetooth settings. + + The Bluetooth settings contain information about the local Bluetooth device, + such as the device model and whether the device is powered on and available + for connections with other Bluetooth devices. + + The Bluetooth device can scan for other Bluetooth devices in range and + retrieve information about them. The Bluetooth device then uses the address + of another device to attempt pairing to it, and connects to it if the + pairing was successful. +*/ + +/*! + \property BluetoothDevice::scanning + \brief Whether the Bluetooth device is scanning for remote devices. +*/ + +/*! + \property BluetoothDevice::powered + \brief Whether the power in the Bluetooth device is on or off. +*/ + +/*! + \property BluetoothDevice::available + \brief Whether the Bluetooth device is available. +*/ + +/*! + \property BluetoothDevice::deviceModel + \brief The model of the Bluetooth device. +*/ + +/*! + Creates a new Bluetooth device with the parent \a parent. +*/ BluetoothDevice::BluetoothDevice(QObject *parent) : QObject(parent) ,d_ptr(new BluetoothDevicePrivate(this)) { } +/*! + Returns \c true if the power is switched on in the Bluetooth device. +*/ bool BluetoothDevice::powered() const { Q_D(const BluetoothDevice); return d->powered(); } +/*! + Sets the powered state in the Bluetooth device to \a aPowered. +*/ void BluetoothDevice::setPowered(const bool& aPowered) { Q_D(BluetoothDevice); d->setPowered(aPowered); } - +/*! + Returns the model of the Bluetooth device. +*/ DiscoveryModel* BluetoothDevice::deviceModel() const { Q_D(const BluetoothDevice); return d->deviceModel(); } +/*! + Returns whether the Bluetooth device is scanning for remote devices. +*/ bool BluetoothDevice::scanning() const { Q_D(const BluetoothDevice); return d->scanning(); } +/*! + Sets scanning in the Bluetooth device to \a aScan. +*/ void BluetoothDevice::setScanning(const bool& aScan) { Q_D(BluetoothDevice); d->setScanning(aScan); } +/*! + Starts the process of pairing to a remote device specified by \a address, + and connects to it if the pairing was successful. + + \sa requestConnect +*/ void BluetoothDevice::requestPairing(const QString& address) { Q_D(BluetoothDevice); d->requestPairing(address); } +/*! + Connects to the remote device specified by \a address. +*/ void BluetoothDevice::requestConnect(const QString& address) { Q_D(BluetoothDevice); d->requestConnect(address); } +/*! + Disconnects from the remote device specified by \a address. +*/ void BluetoothDevice::requestDisconnect(const QString& address) { Q_D(BluetoothDevice); d->requestDisconnect(address); } +/*! + Returns the availability of the Bluetooth device. +*/ bool BluetoothDevice::available() const { Q_D(const BluetoothDevice); diff --git a/src/displaysettings/displaysettings.cpp b/src/displaysettings/displaysettings.cpp index bf15884..de2d416 100644 --- a/src/displaysettings/displaysettings.cpp +++ b/src/displaysettings/displaysettings.cpp @@ -31,24 +31,77 @@ QT_BEGIN_NAMESPACE +/*! + \class DisplaySettings + \inmodule QtDeviceUtilities + + \brief The DisplaySettings class specifies display settings. + + The Boot to Qt demo launcher and Qt Quick Controls scale automatically to + screens of different sizes, from 7-inch touch screens to 60-inch or larger + television screens to ensure readability and touch friendliness. For this, + Qt has to know the physical dimensions of the screen. By default, it tries + to query these values from the framebuffer devices. However, many kernel + drivers do not provide this information. + + The display settings enable overriding and manually setting the physical + screen size. + + In addition, you can set the display brightness. That is, the intensity of + the backlight. +*/ + +/*! + \property DisplaySettings::displayBrightness + \brief The display brightness. + + A value of \c 255 requests the maximum brightness, while that of \c 0 + requests the minimum (typically, the backlight turned off). +*/ + + +/*! + \property DisplaySettings::physicalScreenSizeInch + \brief The physical screen size in inches. +*/ + +/*! + \property DisplaySettings::physicalScreenWidthMm + \brief The physical screen width in millimeters. +*/ + +/*! + \property DisplaySettings::physicalScreenHeightMm + \brief The physical screen height in millimeters. +*/ + +/*! + \property DisplaySettings::physicalScreenSizeOverride + \brief Whether to use the value set for the physical screen size. +*/ + +/*! + Creates a new display settings object with the parent \a parent. +*/ DisplaySettings::DisplaySettings(QObject *parent) : QObject(parent) ,d_ptr(new DisplaySettingsPrivate(this)) { } +/*! + Deletes the display settings object. +*/ DisplaySettings::~DisplaySettings() { } /*! - * Sets the display brightness (i.e. the intensity of the backlight) - * to \a value. A value of 255 requests maximum brightness, while 0 requests - * minimum (typically, the backlight turned off). - * - * Returns true on success. - */ + Sets the display brightness to \a v. + + Returns \c true on success. +*/ bool DisplaySettings::setDisplayBrightness(int v) { Q_D(DisplaySettings); @@ -66,49 +119,77 @@ int DisplaySettings::displayBrightness() return d->displayBrightness(); } - +/*! + Returns the physical screen size in inches. +*/ int DisplaySettings::physicalScreenSizeInch() const { Q_D(const DisplaySettings); return d->physicalScreenSizeInch(); } +/*! + Returns the physical screen width in millimeters. +*/ int DisplaySettings::physicalScreenWidthMm() const { Q_D(const DisplaySettings); return d->physicalScreenWidthMm(); } +/*! + Returns the physical screen height in millimeters. +*/ int DisplaySettings::physicalScreenHeightMm() const { Q_D(const DisplaySettings); return d->physicalScreenHeightMm(); } +/*! + Sets the physical screen size to \a inches. +*/ void DisplaySettings::setPhysicalScreenSizeInch(int inches) { Q_D(DisplaySettings); d->setPhysicalScreenSizeInch(inches); } +/*! + Sets the physical screen width to \a newWidth. +*/ void DisplaySettings::setPhysicalScreenWidthMm(int newWidth) { Q_D(DisplaySettings); d->setPhysicalScreenWidthMm(newWidth); } +/*! + Sets the physical screen height to \a newHeight. +*/ void DisplaySettings::setPhysicalScreenHeightMm(int newHeight) { Q_D(DisplaySettings); d->setPhysicalScreenHeightMm(newHeight); } +/*! + Returns whether the value set for the physical screen size is used. + + \sa physicalScreenSizeInch() +*/ bool DisplaySettings::physicalScreenSizeOverride() const { Q_D(const DisplaySettings); return d->physicalScreenSizeOverride(); } +/*! + Sets whether the value set for the physical screen size is used to + \a enable. + + \sa physicalScreenSizeInch() +*/ void DisplaySettings::setPhysicalScreenSizeOverride(bool enable) { Q_D(DisplaySettings); diff --git a/src/doc/QtDeviceUtilitiesDoc b/src/doc/QtDeviceUtilitiesDoc new file mode 100644 index 0000000..3b3e297 --- /dev/null +++ b/src/doc/QtDeviceUtilitiesDoc @@ -0,0 +1,6 @@ +#include <QtNetworkSettings/QtNetworkSettings> +#include <QtBluetoothSettings/QtBluetoothSettings> +#include <QtLocaleSettings/QtLocaleSettings> +#include <QtTimeDateSettings/QtTimeDateSettings> +#include <QtDisplaySettings/QtDisplaySettings> +#include <QtLocalDevice/QtLocalDevice> diff --git a/src/doc/config/html-offline.qdocconf b/src/doc/config/html-offline.qdocconf deleted file mode 100644 index f9c92b7..0000000 --- a/src/doc/config/html-offline.qdocconf +++ /dev/null @@ -1,29 +0,0 @@ -# use the global Qt template with modifications to the html footer -include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf) -include($QT_INSTALL_DOCS/global/qt-cpp-defines.qdocconf) -include($QT_INSTALL_DOCS/global/fileextensions.qdocconf) - -HTML.nobreadcrumbs = "true" - -# \welcome macro is used in online docs, no output in offline mode -macro.welcome.HTML = "\n" - -HTML.footer = \ - " <div class=\"ft\">\n" \ - " <span></span>\n" \ - " </div>\n" \ - "</div> \n" \ - "<div class=\"footer\">\n" \ - " <p>\n" \ - " <acronym title=\"Copyright\">©</acronym> 2016 The Qt Company Ltd.</p>\n" \ - " <p>\n" \ - " Licensees holding valid commercial Qt licenses may use this document in\n" \ - " accordance with the commercial license agreement provided with the\n" \ - " Software or, alternatively, in accordance with the terms contained in a\n" \ - " written agreement between you and The Qt Company.<\p>\n" \ - " <p>\n" \ - " Qt and respective logos are trademarks of The Qt Company \n" \ - " in Finland and/or other countries worldwide. All other trademarks are property\n" \ - " of their respective owners. <a title=\"Privacy Policy\"\n" \ - " href=\"http://www.qt.io/terms-conditions/#section-2\">Privacy Policy</a></p>\n" \ - "</div>\n" diff --git a/src/doc/config/qtdeviceutilities-online.qdocconf b/src/doc/config/qtdeviceutilities-online.qdocconf deleted file mode 100644 index 59cac90..0000000 --- a/src/doc/config/qtdeviceutilities-online.qdocconf +++ /dev/null @@ -1,5 +0,0 @@ -include($QT_INSTALL_DOCS/global/qt-module-defaults-online-commercial.qdocconf) -include(qtdeviceutilities-project.qdocconf) - -# sidebar used for online template -HTML.stylesheets += style/qt5-sidebar.html diff --git a/src/doc/config/qtdeviceutilities-project.qdocconf b/src/doc/config/qtdeviceutilities-project.qdocconf deleted file mode 100644 index d176779..0000000 --- a/src/doc/config/qtdeviceutilities-project.qdocconf +++ /dev/null @@ -1,55 +0,0 @@ -project = QtDeviceUtilities -description = Qt Device Utilities $QT_VERSION -version = $QT_VERSION -macro.maintitle = "\\title Qt Device Utilities $QT_VERSION" - -sourcedirs += ../src \ - ../../imports/localesettings \ - ../../imports/bluetoothsettings \ - ../../imports/displaysettings \ - ../../imports/localdevice \ - ../../imports/localesettings \ - ../../imports/timedatesettings \ - ../../imports/networksettings \ - ../../settingsui/settingsuiplugin \ - ../../networksettings - -headerdirs += ../../networksettings - -exampledirs += ../../../examples - -imagedirs += ../images - -indexes = $QT_INSTALL_DOCS/qtquick/qtquick.index \ - $QT_INSTALL_DOCS/qtqml/qtqml.index \ - $QT_INSTALL_DOCS/qtdoc/qtdoc.index \ - $QT_INSTALL_DOCS/qtgui/qtgui.index \ - $QT_INSTALL_DOCS/qtcore/qtcore.index \ - $QT_INSTALL_DOCS/qtquickcontrols/qtquickcontrols.index - -qhp.projects = QtDeviceUtilities - -qhp.QtDeviceUtilities.file = qtdeviceutilities.qhp -qhp.QtDeviceUtilities.namespace = io.qt.qtdeviceutilities.$QT_VERSION_TAG -qhp.QtDeviceUtilities.virtualFolder = qtdeviceutilities -qhp.QtDeviceUtilities.indexTitle = Qt Device Utilities $QT_VERSION -qhp.QtDeviceUtilities.indexRoot = - -qhp.QtDeviceUtilities.subprojects = modules -qhp.QtDeviceUtilities.subprojects.modules.title = Modules -qhp.QtDeviceUtilities.subprojects.modules.indexTitle = Qt Device Utilities $QT_VERSION -qhp.QtDeviceUtilities.subprojects.modules.selectors = qmlmodule module -qhp.QtDeviceUtilities.subprojects.modules.sortPages = true - -macro.B2Q = "Boot to Qt" -macro.SDK = "Qt for Device Creation" -macro.QAS = "Qt Automotive Suite" -macro.B2QA = "\\e {Boot to Qt for embedded Android}" -macro.B2QL = "\\e {Boot to Qt for embedded Linux}" - -# Keep Device Creation as the landing page -navigation.landingpage = "Qt for Device Creation" -navigation.qmltypespage = "Qt Device Utilities $QT_VERSION" - -Cpp.ignoredirectives += Q_DECLARE_LOGGING_CATEGORY -Cpp.ignoretokens += Q_DEL_EXPORT diff --git a/src/doc/config/qtdeviceutilities.qdocconf b/src/doc/config/qtdeviceutilities.qdocconf deleted file mode 100644 index 9c56ed8..0000000 --- a/src/doc/config/qtdeviceutilities.qdocconf +++ /dev/null @@ -1,2 +0,0 @@ -include(html-offline.qdocconf) -include(qtdeviceutilities-project.qdocconf) diff --git a/src/doc/doc.pro b/src/doc/doc.pro index d55b9c3..c038f1e 100644 --- a/src/doc/doc.pro +++ b/src/doc/doc.pro @@ -1,9 +1,9 @@ TEMPLATE = aux -build_online_docs: { - QMAKE_DOCS_TARGETDIR = qtdeviceutilities - QMAKE_DOCS = $$PWD/config/qtdeviceutilities-online.qdocconf -} else { - QMAKE_DOCS = $$PWD/config/qtdeviceutilities.qdocconf -} + +CONFIG += force_qt # Needed for Qt include paths + +QMAKE_DOCS = $$PWD/qtdeviceutilities.qdocconf + +build_online_docs: QMAKE_DOCS_TARGETDIR = qtdeviceutilities QMAKE_DOCS_OUTPUTDIR = $$OUT_PWD/qtdeviceutilities diff --git a/src/doc/qtdeviceutilities-project.qdocconf b/src/doc/qtdeviceutilities-project.qdocconf new file mode 100644 index 0000000..e8abc97 --- /dev/null +++ b/src/doc/qtdeviceutilities-project.qdocconf @@ -0,0 +1,85 @@ +include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) + +project = QtDeviceUtilities +description = Qt Device Utilities $QT_VERSION +version = $QT_VERSION +macro.maintitle = "\\title Qt Device Utilities $QT_VERSION" + +includepaths += -I . +# -I ../bluetoothsettings \ +# -I ../displaysettings \ +# -I ../localdevice \ +# -I ../localesettings \ +# -I ../networksettings \ +# -I ../timedatesettings + +# pass a custom module header to Clang +moduleheader = QtDeviceUtilitiesDoc + +sourcedirs += src \ + ../imports/localesettings \ + ../imports/bluetoothsettings \ + ../imports/displaysettings \ + ../imports/localdevice \ + ../imports/localesettings \ + ../imports/timedatesettings \ + ../imports/networksettings \ + ../bluetoothsettings \ + ../displaysettings \ + ../localdevice \ + ../localesettings \ + ../networksettings \ + ../timedatesettings \ + ../settingsui/settingsuiplugin + +headerdirs += ../bluetoothsettings \ + ../displaysettings \ + ../localdevice \ + ../localesettings \ + ../networksettings \ + ../timedatesettings + +exampledirs += ../../examples + +imagedirs += images + +depends = qtcore qtdoc qtgui qtqml qtquick qtquickcontrols qtwidgets + +qhp.projects = QtDeviceUtilities + +qhp.QtDeviceUtilities.file = qtdeviceutilities.qhp +qhp.QtDeviceUtilities.namespace = io.qt.qtdeviceutilities.$QT_VERSION_TAG +qhp.QtDeviceUtilities.virtualFolder = qtdeviceutilities +qhp.QtDeviceUtilities.indexTitle = Qt Device Utilities $QT_VERSION +qhp.QtDeviceUtilities.indexRoot = + +qhp.QtDeviceUtilities.subprojects = classes qmltypes examples + +qhp.QtDeviceUtilities.subprojects.classes.title = C++ Classes +qhp.QtDeviceUtilities.subprojects.classes.indexTitle = Qt Device Utilities C++ Classes +qhp.QtDeviceUtilities.subprojects.classes.selectors = class fake:headerfile +qhp.QtDeviceUtilities.subprojects.classes.sortPages = true + +qhp.QtDeviceUtilities.subprojects.modules.title = QML Types +qhp.QtDeviceUtilities.subprojects.modules.indexTitle = Qt Device Utilities QML Types +qhp.QtDeviceUtilities.subprojects.modules.selectors = qmlmodule module +qhp.QtDeviceUtilities.subprojects.modules.sortPages = true + +qhp.QtWebEngine.subprojects.examples.title = Examples +qhp.QtWebEngine.subprojects.examples.indexTitle = Qt Device Utilities Examples +qhp.QtWebEngine.subprojects.examples.selectors = doc:example +qhp.QtWebEngine.subprojects.examples.sortPages = true + +macro.B2Q = "Boot to Qt" +macro.SDK = "Qt for Device Creation" +macro.QAS = "Qt Automotive Suite" +macro.B2QA = "\\e {Boot to Qt for embedded Android}" +macro.B2QL = "\\e {Boot to Qt for embedded Linux}" + +# Keep Device Creation as the landing page +navigation.landingpage = "Qt for Device Creation" +navigation.qmltypespage = "Qt Device Utilities QML Types" +navigation.cppclassespage = "Qt Device Utilities C++ Classes" + +Cpp.ignoredirectives += Q_DECLARE_LOGGING_CATEGORY +Cpp.ignoretokens += Q_DEL_EXPORT diff --git a/src/doc/qtdeviceutilities.qdocconf b/src/doc/qtdeviceutilities.qdocconf new file mode 100644 index 0000000..5b56cf1 --- /dev/null +++ b/src/doc/qtdeviceutilities.qdocconf @@ -0,0 +1,5 @@ +include(qtdeviceutilities-project.qdocconf) + +# Turn off single-directory output mode +HTML.nosubdirs = "false" +HTML.outputsubdir = qtdeviceutilities diff --git a/src/doc/src/qtdeviceutilities-examples.qdoc b/src/doc/src/qtdeviceutilities-examples.qdoc new file mode 100644 index 0000000..e912b94 --- /dev/null +++ b/src/doc/src/qtdeviceutilities-examples.qdoc @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + + \group qtdeviceutilities-examples + \title Qt Device Utilities Examples + \brief Examples on using Qt Device Utilities. + \ingroup-all-examples + + \l{Qt Device Utilities WiFi Tutorial} demonstrates how you can use + the \l{QtDeviceUtilities.NetworkSettings}{NetworkSettings} module for + connecting to WiFi. + + The source code of Qt Device Utilities is availabe via a public Git repository. + For more information, see \l{Device Utilities Git Repository}. + + You find the Qt Device Utilities module sources under + \l{http://code.qt.io/cgit/qt/qtdeviceutilities.git/tree/src}. Especially, + the sources of \l{Settings UI} provide examples of how to use Qt Device Utilities. +*/ diff --git a/src/doc/src/qtdeviceutilities-index.qdoc b/src/doc/src/qtdeviceutilities-index.qdoc new file mode 100644 index 0000000..af4d26e --- /dev/null +++ b/src/doc/src/qtdeviceutilities-index.qdoc @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page qtdeviceutilities-index.html + \title Qt Device Utilities + \brief Provides functionality that is useful for embedded applications. + + \section1 Getting Started + + To include the definitions of the module's classes, use the following + directive: + + \code + #include <QDeviceUtilities> + \endcode + + To import the QML types into your application, use the following import + statements in your .qml file: + + \code + import QtDeviceUtilities.BluetoothSettings 1.0 + import QtDeviceUtilities.DisplaySettings 1.0 + import QtDeviceUtilities.LocalDeviceSettings 1.0 + import QtDeviceUtilities.LocaleSettings 1.0 + import QtDeviceUtilities.NetworkSettings 1.0 + import QtDeviceUtilities.SettingsUI 1.0 + import QtDeviceUtilities.TimeDateSettings 1.0 + \endcode + + To link against the module, add this line to your qmake .pro file: + + \code + QT += deviceutilities + \endcode + + \section1 Examples + + \list + \li \l {Qt Device Utilities Examples} + \endlist + + \section1 Reference + + \list + \li \l {Qt Device Utilities C++ Classes} {C++ Classes and Namespaces} + \li \l {Qt Device Utilities QML Types} {QML Types} + \endlist +*/ diff --git a/src/doc/src/qtdeviceutilities.qdoc b/src/doc/src/qtdeviceutilities-module-qml.qdoc index 9c7c5d5..44fc688 100644 --- a/src/doc/src/qtdeviceutilities.qdoc +++ b/src/doc/src/qtdeviceutilities-module-qml.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Device Utilities module of the Qt Toolkit. @@ -25,11 +25,30 @@ ** ****************************************************************************/ /*! - \page qtee-module-reference.html - \maintitle - - The \B2Q stack in \SDK includes a number of additional modules that are - useful for embedded applications. + \qmlmodule QtDeviceutilities 1.0 + \title Qt Device Utilities QML Types + \brief Provides additional modules that are useful for embedded + applications. + \ingroup qmlmodules + + The QML types in the modules can be imported into your application using the + following import statements in your .qml file: + + \badcode + import QtDeviceUtilities.BluetoothSettings 1.0 + import QtDeviceUtilities.DisplaySettings 1.0 + import QtDeviceUtilities.LocalDeviceSettings 1.0 + import QtDeviceUtilities.LocaleSettings 1.0 + import QtDeviceUtilities.NetworkSettings 1.0 + import QtDeviceUtilities.SettingsUI 1.0 + import QtDeviceUtilities.TimeDateSettings 1.0 + \endcode + + To link against the module, add this line to your qmake .pro file: + + \badcode + QT += deviceutilities + \endcode \section1 Modules @@ -57,19 +76,5 @@ \section2 Settings UI \generatelist qmltypesbymodule QtDeviceUtilities.SettingsUI - - \section1 Tutorial and Example Code - - \l{Qt Device Utilities WiFi Tutorial} demonstrates how you can use - the \l{QtDeviceUtilities.NetworkSettings}{NetworkSettings} module for - connecting to WiFi. - - The source code of Qt Device Utilities is availabe via a public Git repository. - For more information, see \l{Device Utilities Git Repository}. - - You find the Qt Device Utilities module sources under - \l{http://code.qt.io/cgit/qt/qtdeviceutilities.git/tree/src}. Especially, - the sources of \l{Settings UI} provide examples of how to use Qt Device Utilities. - */ diff --git a/src/doc/src/qtdeviceutitilies-module-cpp.qdoc b/src/doc/src/qtdeviceutitilies-module-cpp.qdoc new file mode 100644 index 0000000..caa9346 --- /dev/null +++ b/src/doc/src/qtdeviceutitilies-module-cpp.qdoc @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \module QtDeviceUtilities + \title Qt Device Utilities C++ Classes + \brief Provides classes that are useful for embedded applications. + \ingroup modules + + \qtvariable deviceutilities + + To include the definitions of the module's classes, use the following + directive: + + \badcode + #include <QtDeviceUtilities> + \endcode + + To link against the module, add this line to your qmake .pro file: + + \badcode + QT += qtdeviceutilities + \endcode +*/ diff --git a/src/doc/src/wifiexample.qdoc b/src/doc/src/wifiexample.qdoc index ce5d43c..2de002b 100644 --- a/src/doc/src/wifiexample.qdoc +++ b/src/doc/src/wifiexample.qdoc @@ -27,7 +27,7 @@ /*! \page qtdeviceutilities-wifitutorial.html \title Qt Device Utilities WiFi Tutorial - \previouspage qtee-module-reference.html + \previouspage Qt Device Utilities Examples \section1 Importing NetworkSettings diff --git a/src/localdevice/qlocaldevice.cpp b/src/localdevice/qlocaldevice.cpp index f6b2c2b..131539a 100644 --- a/src/localdevice/qlocaldevice.cpp +++ b/src/localdevice/qlocaldevice.cpp @@ -32,11 +32,28 @@ QT_BEGIN_NAMESPACE +/*! + \class QLocalDevice + \inmodule QtDeviceUtilities + + \brief The QLocalDevice class provides utility functions for controlling an + embedded device. + + The methods in this class enable shutting down and rebooting an embedded + device. +*/ + +/*! + Creates a new local device with the parent \a parent. +*/ QLocalDevice::QLocalDevice(QObject *parent) : QObject(parent) { } +/*! + Deletes the local device. +*/ QLocalDevice::~QLocalDevice() { } diff --git a/src/localesettings/localefiltermodel.cpp b/src/localesettings/localefiltermodel.cpp index 997a316..3a5d892 100644 --- a/src/localesettings/localefiltermodel.cpp +++ b/src/localesettings/localefiltermodel.cpp @@ -31,6 +31,33 @@ QT_BEGIN_NAMESPACE +/*! + \class LocaleFilterModel + \inmodule QtDeviceUtilities + + \brief The LocaleFilterModel class provides a filtered model for the + available locales. + + This class can be used as the model in a view that lists the available + locales. + + \sa LocaleModel +*/ + +/*! + \property LocaleFilterModel::filter + \brief Holds a string that filters out the locales in the model. + + The filtering process is a case-insensitive matching for whether the region + (country) name contains this string. The string can be taken from user + input. + + \sa LocaleItem::country +*/ + +/*! + Creates a locale filer model with the parent \a parent. +*/ LocaleFilterModel::LocaleFilterModel(QObject* parent) :QSortFilterProxyModel(parent) { @@ -39,22 +66,35 @@ LocaleFilterModel::LocaleFilterModel(QObject* parent) setSourceModel(localeModel); } +/*! + Deletes the locale filter model. +*/ LocaleFilterModel::~LocaleFilterModel() { } +/*! + Returns the locale filter string. +*/ QString LocaleFilterModel::filter() const { return m_filter; } +/*! + Sets the locale filter string to \a aFilter. +*/ void LocaleFilterModel::setFilter(const QString& aFilter) { m_filter = aFilter; emit filterChanged(); } +/*! + Returns whether the row \a source_row has the country role and whether it is + found in the locale model \a source_parent. +*/ bool LocaleFilterModel::filterAcceptsRow( int source_row, const QModelIndex& source_parent ) const { bool ret = false; @@ -76,6 +116,14 @@ bool LocaleFilterModel::filterAcceptsRow( int source_row, const QModelIndex& sou return ret; } +/*! + Returns the locale item at \a row in the locale filter model. + + This item can be assigned to LocaleManager::locale(), when the user selects + a locale from a list. + + \sa LocaleItem +*/ QVariant LocaleFilterModel::itemFromRow(const int row) const { QModelIndex idx = index(row, 0); @@ -91,6 +139,12 @@ QVariant LocaleFilterModel::itemFromRow(const int row) const return QVariant(); } +/*! + Returns the index for the country \a country in the locale filter model. + + The index is used by item views, delegates, and selection models to locate + an item in the model. +*/ int LocaleFilterModel::indexForCountry(const QString &country) const { QAbstractItemModel *model = this->sourceModel(); diff --git a/src/localesettings/localemodel.cpp b/src/localesettings/localemodel.cpp index 6925a02..cd411f3 100644 --- a/src/localesettings/localemodel.cpp +++ b/src/localesettings/localemodel.cpp @@ -35,6 +35,49 @@ QT_BEGIN_NAMESPACE +/*! + \class LocaleItem + \inmodule QtDeviceUtilities + + \brief The LocaleItem class represents a locale. + + This class holds the name, language, and country code of a locale. + + If available, the native country name and language are used. For example, + \e Deutsch and \e Deutschland for the German locale. + + \sa QLocale, LocaleModel +*/ + +/*! + \property LocaleItem::code + \brief The locale code string. + + The locale code is in the format \e language_country, where \e language is + a lowercase, two-letter ISO 639 language code, and \e country is an + uppercase, two- or three-letter ISO 3166 country code. + + \sa QLocale::name() +*/ + +/*! + \property LocaleItem::country + \brief The name of the country. + + \sa QLocale::Country +*/ + +/*! + \property LocaleItem::language + \brief The name of the language. + + \sa QLocale::Language +*/ + + +/*! + Creates the locale item \a locale with the parent \a parent. +*/ LocaleItem::LocaleItem(const QLocale& locale, QObject *parent) :QObject(parent) { @@ -50,21 +93,76 @@ LocaleItem::LocaleItem(const QLocale& locale, QObject *parent) } } +/*! + Returns the language of the country. +*/ QString LocaleItem::language() const { return m_language; } +/*! + Returns the name of the country. +*/ QString LocaleItem::country() const { return m_country; } +/*! + Returns the country code of the country. +*/ QString LocaleItem::code() const { return m_code; } +/*! + \class LocaleModel + \inmodule QtDeviceUtilities + + \brief The LocaleModel class provides a model for the available locales. + + Each item in the model has a set of data elements associated with it, each + with its own role. The roles are used by the view to indicate to the model + which type of data it needs. Custom models should return data in these + types. + + The data in a locale model can be filtered according to the country code, + name, or language. + + \sa LocaleItem, LocaleFilterModel +*/ + +/*! + \enum LocaleModel::Roles + + This enum holds the role of the locale item. + + For user roles, it is up to the developer to decide which types to use and + ensure that components use the correct types when accessing and setting + data. + + \value Language + The language of the country. + \value Country + The name of the country. + \value Code + The locale code string in the format \e language_country. + + \sa Qt::UserRole +*/ + +/*! + \fn LocaleModel::addItem(LocaleItem* item) + + This signal is emitted when the locale item \a item is added to the locale + model. +*/ + +/*! + Creates a locale model with the parent \a parent. +*/ LocaleModel::LocaleModel(QObject *parent) : QAbstractListModel(parent) { @@ -79,6 +177,9 @@ LocaleModel::LocaleModel(QObject *parent) connect(watcher, SIGNAL(finished()), this, SLOT(modelReady())); } +/*! + This signal is emitted when the locale model has been reset. +*/ void LocaleModel::modelReady() { beginResetModel(); @@ -88,6 +189,9 @@ void LocaleModel::modelReady() emit ready(); } +/*! + Creates the locale model \a model. +*/ void LocaleModel::generateModel(LocaleModel* model) { QList<QLocale> allLocales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript, QLocale::AnyCountry); @@ -110,22 +214,41 @@ void LocaleModel::addNewItem(QObject *item) endInsertRows(); } +/*! + Deletes the locale model. +*/ LocaleModel::~LocaleModel() { qDeleteAll(m_items); } +/*! + Returns an array of user roles. + + \sa Roles +*/ QHash<int, QByteArray> LocaleModel::roleNames() const { return m_roleNames; } +/*! + Returns the number of rows in the locale model. +*/ int LocaleModel::rowCount(const QModelIndex & parent) const { Q_UNUSED(parent); return m_items.count(); } +/*! + Returns the locale item at \a index in the locale model for \a role. + + This item can be assigned to LocaleManager::locale(), when the user selects + a locale from a list. + + \sa LocaleItem, Roles +*/ QVariant LocaleModel::data(const QModelIndex & index, int role) const { if (!index.isValid()) return QVariant(); @@ -150,11 +273,23 @@ QVariant LocaleModel::data(const QModelIndex & index, int role) const } } +/*! + Returns whether the locale item has more than one languages specified. + + If the language variant of the locale item if \a v1 is less than \a v2 ##? + +*/ bool LocaleModel::variantLessThan(const LocaleItem* v1, const LocaleItem* v2) { return v1->language() < v2->language(); } +/*! + Sets the sorting order of the items in the locale model to \a order. + + The sort order can be either \l {Qt::AscendingOrder}{ascending} or + \l {Qt::DescendingOrder}{descending}. +*/ void LocaleModel::sort(int column, Qt::SortOrder order) { Q_UNUSED(column); @@ -162,6 +297,12 @@ void LocaleModel::sort(int column, Qt::SortOrder order) std::sort(m_items.begin(), m_items.end(), LocaleModel::variantLessThan); } +/*! + Returns the index for the country \a country in the locale model. + + The index is used by item views, delegates, and selection models to locate + an item in the model. +*/ QModelIndex LocaleModel::indexForCountry(const QString &country) const { for (int i = 0; i < m_items.count(); i++) { diff --git a/src/networksettings/qnetworksettings.cpp b/src/networksettings/qnetworksettings.cpp index 66a9ba2..324959e 100644 --- a/src/networksettings/qnetworksettings.cpp +++ b/src/networksettings/qnetworksettings.cpp @@ -30,27 +30,129 @@ QT_BEGIN_NAMESPACE +/*! + \class QNetworkSettingsState + \inmodule QtDeviceUtilities + + \brief The QNetworkSettingsState class represents the network interface + state. + + \sa QNetworkSettingsManager +*/ + +/*! + \enum QNetworkSettingsState::States + + This enum type holds the state of the network interface. + + \value Idle + \value Failure + Failed to connect. + \value Association + Authentication in progress. + \value Configuration + Configuration in progress. + \value Ready + Connected to a network. + \value Disconnect + Disconnected from a network. + \value Online + Acquired an IP address. + \value Undefined + Undefined state. +*/ + +/*! + \property QNetworkSettingsState::state + \brief The state of the network interface. + + \sa QNetworkSettingsState::States +*/ + +/*! + \fn QNetworkSettingsState::stateChanged() + This signal is emitted when the state of the network interface changes. + + \sa QNetworkSettingsState::States +*/ + +/*! + Creates a new network interface state object with the state \a state and the + parent \a parent. +*/ QNetworkSettingsState::QNetworkSettingsState(States state, QObject *parent) : QObject(parent) , m_state(state) { } +/*! + Creates a new network interface state object with the parent \a parent. +*/ QNetworkSettingsState::QNetworkSettingsState(QObject *parent) : QObject(parent) , m_state(Undefined) { } +/*! + Returns the network interface state. +*/ QNetworkSettingsState::States QNetworkSettingsState::state() const { return m_state; } +/*! + Sets the network interface state to \a state. +*/ void QNetworkSettingsState::setState(const States state) { m_state = state; emit stateChanged(); } +/*! + \class QNetworkSettingsType + \inmodule QtDeviceUtilities + + \brief The QNetworkSettingsType class represents the network interface + type. + + \sa QNetworkSettingsManager +*/ + +/*! + \enum QNetworkSettingsType::Types + + This enum type holds the type of the network interface. + + \value Wired + Wired network + \value Wifi + Wifi network + \value Bluetooth + Bluetooth network + \value Unknown + Unknown network type +*/ + +/*! + \property QNetworkSettingsType::type + \brief The type of the network interface. + + \sa QNetworkSettingsType::Types +*/ + +/*! + \fn QNetworkSettingsType::typeChanged() + This signal is emitted when the type of the network interface changes. + + \sa QNetworkSettingsType::Types +*/ + +/*! + Creates a new network interface type object with the type \a type and + parent \a parent. +*/ QNetworkSettingsType::QNetworkSettingsType(Types type, QObject *parent) : QObject(parent) , m_type(type) @@ -58,21 +160,76 @@ QNetworkSettingsType::QNetworkSettingsType(Types type, QObject *parent) m_type = type; } +/*! + Creates a new network interface type object with the parent \a parent. +*/ QNetworkSettingsType::QNetworkSettingsType(QObject *parent) : QObject(parent) { m_type = Unknown; } +/*! + Returns the network interface type. +*/ QNetworkSettingsType::Types QNetworkSettingsType::type() const { return m_type; } +/*! + Sets the network interface type to \a type. +*/ void QNetworkSettingsType::setType(const Types type) { m_type = type; emit typeChanged(); } +/*! + \class QNetworkSettingsIPv4 + \inmodule QtDeviceUtilities + + \brief The QNetworkSettingsIPv4 class encapsulates IPv4 network + configuration. +*/ + +/*! + \enum QNetworkSettingsIPv4::MethodType + + This enum type holds the method used for IPv4 configuration. + + \value Dhcp + The DHCP protocol is used for the network configuration. + \value Manual + The network is configured manually. + \value Off + The network is not configured. +*/ + +/*! + \property QNetworkSettingsIPv4::address + \brief Holds the IPv4 address. +*/ + +/*! + \property QNetworkSettingsIPv4::gateway + \brief Holds the IPv4 gateway address. +*/ + +/*! + \property QNetworkSettingsIPv4::method + \brief Holds the method of IPv4 configuration. + + \sa QNetworkSettingsIPv4::MethodType +*/ + +/*! + \property QNetworkSettingsIPv4::mask + \brief Holds the IPv4 network mask. +*/ + +/*! + Creates a new IPv4 network configuration with the parent \a parent. +*/ QNetworkSettingsIPv4::QNetworkSettingsIPv4(QObject *parent) : QObject(parent) { @@ -81,6 +238,7 @@ QNetworkSettingsIPv4::QNetworkSettingsIPv4(QObject *parent) QString QNetworkSettingsIPv4::address() const { return m_address; } + void QNetworkSettingsIPv4::setAddress(const QString& address) { m_address = address; emit addressChanged(); @@ -113,6 +271,74 @@ void QNetworkSettingsIPv4::setMask(const QString& mask) { emit maskChanged(); } +/*! + \class QNetworkSettingsIPv6 + \inmodule QtDeviceUtilities + + \brief The QNetworkSettingsIPv6 class encapsulates IPv6 network + configuration. +*/ + +/*! + \enum QNetworkSettingsIPv6::MethodType + + This enum type holds the method used for IPv6 configuration. + + \value Auto + The network is configured automatically. + \value Manual + The network is configured manually. + \value Off + The network is not configured. +*/ + +/*! + \enum QNetworkSettingsIPv6::PrivacyType + \brief Holds the method of applying the privacy extensions in IPv6. + + \value Disabled + Disables privacy extensions in IPv6 + \value Enabled + Enables \l {https://tools.ietf.org/html/rfc4941} + {Privacy Extensions for Stateless Address Autoconfiguration in IPv6}. + \value Preferred + Enables privacy extensions and gives preference to the use of + temporary addresses, even when a public address is available +*/ + +/*! + \property QNetworkSettingsIPv6::address + \brief Holds the IPv6 address. +*/ + +/*! + \property QNetworkSettingsIPv6::gateway + \brief Holds the IPv6 gateway address. +*/ + +/*! + \property QNetworkSettingsIPv6::method + \brief Holds the method of IPv6 configuration. + + \sa QNetworkSettingsIPv6::MethodType +*/ + +/*! + \property QNetworkSettingsIPv6::privacy + \brief Holds the method of applying privacy extensions for IPv6. + + \sa QNetworkSettingsIPv6::PrivacyType +*/ + +/*! + \property QNetworkSettingsIPv6::prefixLength + \brief Holds the IPv6 network prefix length in bits. +*/ + + +/*! + Creates a new IPv6 network configuration with the parent \a parent. +*/ QNetworkSettingsIPv6::QNetworkSettingsIPv6(QObject *parent) : QObject(parent) { @@ -163,6 +389,62 @@ void QNetworkSettingsIPv6::setPrefixLength(const int& prefixLength) { emit prefixLengthChanged(); } + +/*! + \class QNetworkSettingsProxy + \inmodule QtDeviceUtilities + \brief The QNetworkSettingsProxy class encapsulates network proxy + configuration. +*/ + +/*! + \enum QNetworkSettingsProxy::MethodType + \brief Holds the network proxy configuration method. + + \value Direct + Direct network connection, no proxy in use + \value Auto + Automatic proxy configuration + \value Manual + Manual proxy configuration + + \sa url +*/ + +/*! + \property QNetworkSettingsProxy::method + \brief Holds the network proxy configuration method. + + \sa MethodType +*/ + +/*! + \property QNetworkSettingsProxy::url + \brief Holds the proxy URL. + + For manual proxy configuration, this property holds the proxy server + address. For automatic configuration, it holds the proxy auto-config URL. + + \sa MethodType +*/ + +/*! + \property QNetworkSettingsProxy::excludes + \readonly + \brief The model containing the proxy exclusion list. + + The addresses in the proxy exclusion list are accessed directly, + instead of forwarding the requests to a proxy. + + This property can be used as a model for a view + that lists the proxy exclusion addresses. + + \sa QNetworkSettingsAddressModel +*/ + +/*! + Creates a new proxy configuration with the parent \a parent. +*/ QNetworkSettingsProxy::QNetworkSettingsProxy(QObject *parent) : QObject(parent) { @@ -213,10 +495,58 @@ void QNetworkSettingsProxy::setMethod(const MethodType& method) { emit methodChanged(); } +/*! + \class QNetworkSettingsWireless + \inmodule QtDeviceUtilities + \brief The QNetworkSettingsWireless class encapsulates the configuration + for a Wifi network service. +*/ + +/*! + \enum QNetworkSettingsWireless::SecurityFlags + \brief This enum type holds the wireless security protocol used to + protect the connection. + + \value None + Not protected + \value WEP + Wired Equivalent Privacy (WEP) + \value WPA + Wi-Fi Protected Access (WPA) + \value WPA2 + Wi-Fi Protected Access, version 2 (WPA2) +*/ + +/*! + \property QNetworkSettingsWireless::signalStrength + \brief Holds the Wifi signal strength, in the range from 0 to 100. +*/ + +/*! + \property QNetworkSettingsWireless::hidden + \readonly + \brief Holds whether the wireless SSID is hidden. +*/ + +/*! + \property QNetworkSettingsWireless::isOutOfRange + \brief Holds whether the Wifi access point is out of range. +*/ + + +/*! + Creates a new Wifi network configuration with the parent \a parent. +*/ QNetworkSettingsWireless::QNetworkSettingsWireless(QObject* parent) : QObject(parent) { } +/*! + Returns whether the Wifi network supports the wireless security + protocols specified in \a security. + + \sa QNetworkSettingsWireless::SecurityFlags +*/ bool QNetworkSettingsWireless::supportsSecurity(SecurityFlags security) { if (m_securityFlags & security) { return true; diff --git a/src/networksettings/qnetworksettingsaddressmodel.cpp b/src/networksettings/qnetworksettingsaddressmodel.cpp index d86318b..7872018 100644 --- a/src/networksettings/qnetworksettingsaddressmodel.cpp +++ b/src/networksettings/qnetworksettingsaddressmodel.cpp @@ -30,17 +30,49 @@ QT_BEGIN_NAMESPACE +/*! + \class QNetworkSettingsAddressModel + \inmodule QtDeviceUtilities + + \brief The QNetworkSettingsAddressModel class represents a network + interface address. + + An address model contains a lists of available network interface addresses. + + \sa QNetworkSettingsManager +*/ + +/*! + \property QNetworkSettingsAddressModel::count + \brief Holds the number of rows in the model. +*/ + +/*! + \fn QNetworkSettingsAddressModel::countChanged() + This signal is emitted when the number of rows in the model changes. +*/ + +/*! + Creates an address model with the parent \a parent. +*/ QNetworkSettingsAddressModel::QNetworkSettingsAddressModel(QObject *parent) :QStringListModel(parent) { } +/*! + Creates an address model with the addresses specified by + \a strings and parent \a parent. +*/ QNetworkSettingsAddressModel::QNetworkSettingsAddressModel(const QStringList &strings, QObject *parent) :QStringListModel(parent) { setStringList(strings); } +/*! + Adds the addresses specified by \a addresses to the address model. +*/ void QNetworkSettingsAddressModel::setStringList(const QStringList &addresses) { m_addresses = addresses; @@ -48,6 +80,9 @@ void QNetworkSettingsAddressModel::setStringList(const QStringList &addresses) emit countChanged(); } +/*! + Adds the address specified by \a address to the address model. +*/ void QNetworkSettingsAddressModel::append(const QString& address) { int row = rowCount(); @@ -61,17 +96,27 @@ void QNetworkSettingsAddressModel::append(const QString& address) emit countChanged(); } +/*! + Removes the address at the position specified by \a index from the address + model. +*/ void QNetworkSettingsAddressModel::remove(int index) { removeRows(index, 1); emit countChanged(); } +/*! + Returns the number of rows in the address model. +*/ int QNetworkSettingsAddressModel::count() const { return rowCount(); } +/*! + Resets the changes made to the addresses in the address model. +*/ void QNetworkSettingsAddressModel::resetChanges() { QStringListModel::setStringList(m_addresses); diff --git a/src/networksettings/qnetworksettingsinterface.cpp b/src/networksettings/qnetworksettingsinterface.cpp index 9fb0147..7bf6ae0 100644 --- a/src/networksettings/qnetworksettingsinterface.cpp +++ b/src/networksettings/qnetworksettingsinterface.cpp @@ -33,6 +33,45 @@ QT_BEGIN_NAMESPACE /*! + \class QNetworkSettingsInterface + \inmodule QtDeviceUtilities + \brief Represents a network interface. + + The QNetworkSettingsInterface class represents a network interface attached + to the host. + + Instances of this class cannot be created directly. Instead, they can be + retrieved via QNetworkSettingsManager::interfaces(). +*/ + +/*! + \property QNetworkSettingsInterface::state + \readonly + \brief Holds the state of the network interface. + + \sa QNetworkSettingsState::States +*/ + +/*! + \property QNetworkSettingsInterface::name + \readonly + \brief Holds the name of the network interface. +*/ + +/*! + \property QNetworkSettingsInterface::powered + \brief Holds whether the network interface is powered on of off. +*/ + +/*! + \property QNetworkSettingsInterface::type + \readonly + \brief Holds the type of the network interface. + + \sa QNetworkSettingsType::Types +*/ + +/*! \qmltype NetworkInterface \inqmlmodule QtDeviceUtilities.NetworkSettings \brief Represents a network interface. @@ -46,6 +85,10 @@ QT_BEGIN_NAMESPACE \sa {NetworkSettingsManager::interfaces}{NetworkSettingsManager.interfaces} */ + +/*! + Creates a new network interface with the parent \a parent. +*/ QNetworkSettingsInterface::QNetworkSettingsInterface(QObject *parent) : QObject(parent) ,d_ptr(new QNetworkSettingsInterfacePrivate(this)) @@ -58,6 +101,10 @@ QNetworkSettingsInterface::QNetworkSettingsInterface(QObject *parent) : \readonly \brief Holds the name of the network interface. */ + +/*! + Returns the name of the network interface. +*/ QString QNetworkSettingsInterface::name() const { Q_D(const QNetworkSettingsInterface); @@ -95,6 +142,10 @@ QString QNetworkSettingsInterface::name() const \value NetworkSettingsState.Undefined Undefined state. */ + +/*! + Returns the state of the network interface. +*/ QNetworkSettingsState::States QNetworkSettingsInterface::state() { Q_D(QNetworkSettingsInterface); @@ -113,6 +164,10 @@ QNetworkSettingsState::States QNetworkSettingsInterface::state() \value NetworkSettingsType.Bluetooth Bluetooth network \value NetworkSettingsType.Unknown Unknown network type */ + +/*! + Returns the type of the network interface. +*/ QNetworkSettingsType::Types QNetworkSettingsInterface::type() { Q_D(QNetworkSettingsInterface); @@ -121,7 +176,11 @@ QNetworkSettingsType::Types QNetworkSettingsInterface::type() /*! \qmlproperty bool NetworkInterface::powered - \brief Holds whether the network interface is powered on of off. + \brief Holds whether the network interface is powered on or off. +*/ + +/*! + Returns whether the network interface is powered on or off. */ bool QNetworkSettingsInterface::powered() const { @@ -129,6 +188,9 @@ bool QNetworkSettingsInterface::powered() const return d->powered(); } +/*! + Sets the powered state in the network interface to \a powered. +*/ void QNetworkSettingsInterface::setPowered(const bool powered) { Q_D(QNetworkSettingsInterface); @@ -139,6 +201,10 @@ void QNetworkSettingsInterface::setPowered(const bool powered) \qmlmethod void NetworkInterface::scanServices() \brief Initiates a scan for network interface services. */ + +/*! + Initiates a scan for network interface services. +*/ void QNetworkSettingsInterface::scanServices() { Q_D(QNetworkSettingsInterface); diff --git a/src/networksettings/qnetworksettingsinterfacemodel.cpp b/src/networksettings/qnetworksettingsinterfacemodel.cpp index baff929..b099c6d 100644 --- a/src/networksettings/qnetworksettingsinterfacemodel.cpp +++ b/src/networksettings/qnetworksettingsinterfacemodel.cpp @@ -31,6 +31,33 @@ QT_BEGIN_NAMESPACE +/*! + \class QNetworkSettingsInterfaceModel + \inmodule QtDeviceUtilities + \brief The QNetworkSettingsInterfaceModel class represents a network + interface model. + + The network interface model contains a list of network interfaces + attached to the host. +*/ + +/*! + \enum QNetworkSettingsInterfaceModel::Roles + \brief This enum type holds information about a network interface. + + \value Type + Network interface \l{QNetworkSettingsType::Types}{type}. + \value Status + Network interface \l{QNetworkSettingsState::States}{state}. + \value Name + Network interface name. + \value Powered + Whether the network interface is powered on or off. +*/ + +/*! + Creates a new network interface model with the parent \a parent. +*/ QNetworkSettingsInterfaceModel::QNetworkSettingsInterfaceModel(QObject *parent) : QAbstractListModel(parent) { @@ -41,18 +68,27 @@ QNetworkSettingsInterfaceModel::QNetworkSettingsInterfaceModel(QObject *parent) m_roleNames.insert(Powered, "powered"); } +/*! + Returns an array of the names of the roles in the model. +*/ QHash<int, QByteArray> QNetworkSettingsInterfaceModel::roleNames() const { return m_roleNames; } - +/*! + Returns the number of rows in the model with the parent \a parent. +*/ int QNetworkSettingsInterfaceModel::rowCount(const QModelIndex & parent) const { Q_UNUSED(parent); return m_items.count(); } +/*! + Returns the data at the index \a index in the model for the type of data + specified by \a role. +*/ QVariant QNetworkSettingsInterfaceModel::data(const QModelIndex & index, int role) const { if (!index.isValid()) return QVariant(); @@ -81,6 +117,9 @@ QVariant QNetworkSettingsInterfaceModel::data(const QModelIndex & index, int rol } +/*! + Appends \a item to the model. +*/ void QNetworkSettingsInterfaceModel::append(QNetworkSettingsInterface* item) { item->setParent(this); @@ -91,6 +130,9 @@ void QNetworkSettingsInterfaceModel::append(QNetworkSettingsInterface* item) endInsertRows(); } +/*! + Inserts \a item into \a row in the model. +*/ void QNetworkSettingsInterfaceModel::insert(int row, QNetworkSettingsInterface* item) { item->setParent(this); @@ -107,6 +149,9 @@ void QNetworkSettingsInterfaceModel::connectStateChanges(QNetworkSettingsInterfa connect(item, &QNetworkSettingsInterface::poweredChanged, this, &QNetworkSettingsInterfaceModel::poweredChanged); } +/*! + Removes the row \a row from the model. +*/ void QNetworkSettingsInterfaceModel::remove(int row) { beginRemoveRows(QModelIndex(), row, row); @@ -119,6 +164,9 @@ void QNetworkSettingsInterfaceModel::updated(int row) dataChanged(createIndex(row, 0), createIndex(row, 0)); } +/*! + Returns the network interface model. +*/ QList<QNetworkSettingsInterface*> QNetworkSettingsInterfaceModel::getModel() { return m_items; diff --git a/src/networksettings/qnetworksettingsmanager.cpp b/src/networksettings/qnetworksettingsmanager.cpp index e3f8e50..b1cfbf8 100644 --- a/src/networksettings/qnetworksettingsmanager.cpp +++ b/src/networksettings/qnetworksettingsmanager.cpp @@ -37,24 +37,116 @@ QT_BEGIN_NAMESPACE +/*! + \class QNetworkSettingsManager + \inmodule QtDeviceUtilities + + \brief The QNetworkSettingsManager class manages network settings. + + The network manager is designed to be used as a model that contains lists + of available network interfaces and services. + + A delegate in a view that uses the interface model can access the + network interface item with the data model role. + + The services list in the model can be controlled with the + \l QNetworkSettingsType::type property, and network service items can be + retrieved with the \l QNetworkSettingsServiceFilter::itemFromRow() method. + + \sa QNetworkSettingsService +*/ + +/*! + \property QNetworkSettingsManager::services + \brief Holds the service model. + + \sa QNetworkSettingsServiceFilter +*/ + +/*! + \property QNetworkSettingsManager::interfaces + \brief Holds the interface model. + + \sa QNetworkSettingsInterfaceModel +*/ + +/*! + \property QNetworkSettingsManager::userAgent + \brief Holds the user credentials for connecting to a network. + + \sa QNetworkSettingsUserAgent +*/ + +/*! + \property QNetworkSettingsManager::currentWifiConnection + \brief Holds the current Wifi connection. + + \sa QNetworkSettingsService +*/ + +/*! + \property QNetworkSettingsManager::currentWiredConnection + \brief Holds the current wired connection. + + \sa QNetworkSettingsService +*/ + +/*! + \fn QNetworkSettingsManager::servicesChanged() + + This signal is emitted when the network service changes. +*/ + +/*! + \fn QNetworkSettingsManager::interfacesChanged() + + This signal is emitted when the network interface changes. +*/ + +/*! + \fn QNetworkSettingsManager::currentWifiConnectionChanged() + + This signal is emitted when the current Wifi connection changes. +*/ + +/*! + \fn QNetworkSettingsManager::currentWiredConnectionChanged() + + This signal is emitted when the current wired connection changes. +*/ + +/*! + Creates a network manager with the parent \a parent. +*/ QNetworkSettingsManager::QNetworkSettingsManager(QObject *parent) : QObject(parent) ,d_ptr(new QNetworkSettingsManagerPrivate(this)) { } +/*! + Returns the service model. + + \l QNetworkSettingsType::Types +*/ QNetworkSettingsServiceFilter *QNetworkSettingsManager::services() { Q_D(QNetworkSettingsManager); return d->serviceFilter(); } +/*! + Returns the interface model. +*/ QNetworkSettingsInterfaceModel *QNetworkSettingsManager::interfaces() { Q_D(QNetworkSettingsManager); return d->interfaceModel(); } +/*! + Returns the service model \a name of the type \a type. +*/ QNetworkSettingsService* QNetworkSettingsManager::service(const QString& name, int type) { Q_D(QNetworkSettingsManager); @@ -67,6 +159,10 @@ QNetworkSettingsService* QNetworkSettingsManager::service(const QString& name, i return nullptr; } +/*! + Creates a connection to the network specified by \a name using the password + \a passphrase. +*/ void QNetworkSettingsManager::connectBySsid(const QString &name, const QString &passphrase) { Q_D(QNetworkSettingsManager); @@ -76,6 +172,9 @@ void QNetworkSettingsManager::connectBySsid(const QString &name, const QString & d->connectBySsid(name); } +/*! + Clears the connection state. +*/ void QNetworkSettingsManager::clearConnectionState() { Q_D(QNetworkSettingsManager); @@ -85,12 +184,18 @@ void QNetworkSettingsManager::clearConnectionState() agent->clearConnectionState(); } +/*! + Attempts to connect using the next network interface in the model. +*/ void QNetworkSettingsManager::tryNextConnection() { Q_D(QNetworkSettingsManager); d->tryNextConnection(); } +/*! + Terminates the current connection to the specified \a service. +*/ void QNetworkSettingsManager::clearCurrentConnection(QNetworkSettingsService* service) { Q_D(QNetworkSettingsManager); @@ -109,6 +214,9 @@ void QNetworkSettingsManager::clearCurrentConnection(QNetworkSettingsService* se } } +/*! + Creates a connection to the specified \a service. +*/ void QNetworkSettingsManager::setCurrentConnection(QNetworkSettingsService* service) { Q_D(QNetworkSettingsManager); @@ -125,19 +233,27 @@ void QNetworkSettingsManager::setCurrentConnection(QNetworkSettingsService* serv } } +/*! + Returns the current Wifi connection. +*/ QNetworkSettingsService* QNetworkSettingsManager::currentWifiConnection() { Q_D(QNetworkSettingsManager); return d->currentWifiConnection(); } - +/*! + Returns the current wired connection. +*/ QNetworkSettingsService* QNetworkSettingsManager::currentWiredConnection() { Q_D(QNetworkSettingsManager); return d->currentWiredConnection(); } +/*! + Returns the network interface instance \a instance of the type \a type. +*/ QNetworkSettingsInterface* QNetworkSettingsManager::interface(int type, int instance) { Q_D(QNetworkSettingsManager); @@ -154,6 +270,9 @@ QNetworkSettingsInterface* QNetworkSettingsManager::interface(int type, int inst return nullptr; } +/*! + Sets the user credentials for connecting to a network to \a agent. +*/ void QNetworkSettingsManager::setUserAgent(QNetworkSettingsUserAgent *agent) { Q_D(QNetworkSettingsManager); @@ -162,6 +281,9 @@ void QNetworkSettingsManager::setUserAgent(QNetworkSettingsUserAgent *agent) this, &QNetworkSettingsManager::tryNextConnection); } +/*! + Returns the user credentials for connecting to a network. +*/ QNetworkSettingsUserAgent* QNetworkSettingsManager::userAgent() { Q_D(QNetworkSettingsManager); diff --git a/src/networksettings/qnetworksettingsservice.cpp b/src/networksettings/qnetworksettingsservice.cpp index d3ea020..c91c4f6 100644 --- a/src/networksettings/qnetworksettingsservice.cpp +++ b/src/networksettings/qnetworksettingsservice.cpp @@ -32,6 +32,107 @@ QT_BEGIN_NAMESPACE /*! + \class QNetworkSettingsService + \inmodule QtDeviceUtilities + + \brief The QNetworkSettingsService class represents a network service. + + \sa QNetworkSettingsManager::services() +*/ + +/*! + \property QNetworkSettingsService::id + \readonly + \brief Holds a unique ID of this service. +*/ + +/*! + \property QNetworkSettingsService::name + \readonly + \brief Holds the name of this service. +*/ + + +/*! + \property QNetworkSettingsService::state + \readonly + \brief Holds the state of this service. + + \sa QNetworkSettingsState::States +*/ + +/*! + \property QNetworkSettingsService::type + \readonly + \brief Holds the type of this service. + + \sa QNetworkSettingsType::Types +*/ + +/*! + \property QNetworkSettingsService::ipv4 + \readonly + \brief Holds the IPv4 address for this service. +*/ + +/*! + \property QNetworkSettingsService::ipv6 + \readonly + \brief Holds the IPv6 address for this service. +*/ + +/*! + \property QNetworkSettingsService::proxy + \readonly + \brief Holds the proxy settings for this service. +*/ + +/*! + \property QNetworkSettingsService::wirelessConfig + \readonly + \brief Holds the wireless configuration for this service. +*/ + +/*! + \property QNetworkSettingsService::domains + \readonly + \brief The model containing the domains associated with this service. + + This property can be used as a model for a view that lists the domain + addresses associated with this service. +*/ + +/*! + \property QNetworkSettingsService::nameservers + \readonly + \brief The model containing the domain name servers associated with this + service. + + This property can be used as a model for a view that lists the domain name + server (DNS) addresses associated with this service. +*/ + +/*! + \fn QNetworkSettingsService::connectionStateCleared() + + This signal is emitted when the connection state is cleared. +*/ + +/*! + \fn QNetworkSettingsService::serviceConnected(QNetworkSettingsService* service); + + This signal is emitted when the connection to the network \a service is + created. +*/ + +/*! + \fn QNetworkSettingsService::serviceDisconnected(QNetworkSettingsService* service); + + This signal is emitted when the connection to the network \a service is + cut. +*/ + +/*! \qmltype NetworkService \inqmlmodule QtDeviceUtilities.NetworkSettings \brief Represents a network service. @@ -44,6 +145,10 @@ QT_BEGIN_NAMESPACE \sa {NetworkSettingsManager::services}{NetworkSettingsManager.services} */ +/*! + Creates a network service with the identifier \a aServiceId and + parent \a parent. +*/ QNetworkSettingsService::QNetworkSettingsService(const QString& aServiceId, QObject* parent) : QObject(parent) ,d_ptr(new QNetworkSettingsServicePrivate(aServiceId, this)) @@ -56,6 +161,10 @@ QNetworkSettingsService::QNetworkSettingsService(const QString& aServiceId, QObj \readonly \brief Holds a unique ID of this service. */ + +/*! + Returns the unique identifier of the network service. +*/ QString QNetworkSettingsService::id() const { Q_D(const QNetworkSettingsService); @@ -67,6 +176,10 @@ QString QNetworkSettingsService::id() const \readonly \brief Holds the name of this service. */ + +/*! + Returns the network service name. +*/ QString QNetworkSettingsService::name() const { Q_D(const QNetworkSettingsService); @@ -76,6 +189,11 @@ QString QNetworkSettingsService::name() const /*! \qmlmethod void NetworkService::setAutoConnect(bool auto) */ + +/*! + Sets automatic connections to the network service to + \a autoconnect. +*/ void QNetworkSettingsService::setAutoConnect(const bool autoconnect) { Q_UNUSED(autoconnect); @@ -89,6 +207,12 @@ void QNetworkSettingsService::setAutoConnect(const bool autoconnect) See \l [QML] {NetworkInterface::state}{NetworkInterface.state} for possible states. */ + +/*! + Returns the network service state. + + \sa QNetworkSettingsState::States +*/ QNetworkSettingsState::States QNetworkSettingsService::state() { Q_D(QNetworkSettingsService); @@ -103,6 +227,12 @@ QNetworkSettingsState::States QNetworkSettingsService::state() See \l [QML] {NetworkInterface::type}{NetworkInterface.type} for possible types. */ + +/*! + Returns the network service type. + + \sa QNetworkSettingsType::Types +*/ QNetworkSettingsType::Types QNetworkSettingsService::type() { Q_D(QNetworkSettingsService); @@ -114,6 +244,10 @@ QNetworkSettingsType::Types QNetworkSettingsService::type() \readonly \brief Holds the IPv4 address for this service. */ + +/*! + Returns the IPv4 address of the network service. +*/ QNetworkSettingsIPv4* QNetworkSettingsService::ipv4() { Q_D(QNetworkSettingsService); @@ -125,6 +259,10 @@ QNetworkSettingsIPv4* QNetworkSettingsService::ipv4() \readonly \brief Holds the IPv6 address for this service. */ + +/*! + Returns the IPv6 address of the network service. +*/ QNetworkSettingsIPv6* QNetworkSettingsService::ipv6() { Q_D(QNetworkSettingsService); @@ -136,6 +274,10 @@ QNetworkSettingsIPv6* QNetworkSettingsService::ipv6() \readonly \brief Holds the proxy settings for this service. */ + +/*! + Returns the address of proxy used for the network service. +*/ QNetworkSettingsProxy* QNetworkSettingsService::proxy() { Q_D(QNetworkSettingsService); @@ -147,18 +289,29 @@ QNetworkSettingsProxy* QNetworkSettingsService::proxy() \readonly \brief Holds the wireless configuration for this service. */ + +/*! + Returns the wireless configuration of the network service. +*/ QNetworkSettingsWireless* QNetworkSettingsService::wirelessConfig() { Q_D(QNetworkSettingsService); return &d->m_wifiConfig; } +/*! + Sets the placeholder state of the network service to + \a placeholderState. +*/ void QNetworkSettingsService::setPlaceholderState(bool placeholderState) { Q_D(QNetworkSettingsService); d->setPlaceholderState(placeholderState); } +/*! + Returns the placeholder state of the network service. +*/ bool QNetworkSettingsService::placeholderState() const { Q_D(const QNetworkSettingsService); @@ -197,6 +350,10 @@ bool QNetworkSettingsService::placeholderState() const \brief Clears unsaved changes from the \l domains model. */ +/*! + Returns the model containing the domains associated with this network + settings service. +*/ QAbstractItemModel* QNetworkSettingsService::domains() { Q_D(QNetworkSettingsService); @@ -238,6 +395,10 @@ QAbstractItemModel* QNetworkSettingsService::domains() \brief Clears unsaved changes from the \l nameservers model. */ +/*! + Returns the model containing the domain name servers associated with this + network service. +*/ QAbstractItemModel* QNetworkSettingsService::nameservers() { Q_D(QNetworkSettingsService); @@ -252,6 +413,14 @@ QAbstractItemModel* QNetworkSettingsService::nameservers() \sa ipv4 */ + +/*! + Sets up the IPv4 configuration. + + Call this method after changing the IPv4 settings. + + \sa ipv4() +*/ void QNetworkSettingsService::setupIpv4Config() { Q_D(QNetworkSettingsService); @@ -266,6 +435,14 @@ void QNetworkSettingsService::setupIpv4Config() \sa ipv6 */ + +/*! + Sets up the IPv6 configuration. + + Call this method after changing the IPv6 settings. + + \sa ipv6() +*/ void QNetworkSettingsService::setupIpv6Config() { Q_D(QNetworkSettingsService); @@ -280,6 +457,14 @@ void QNetworkSettingsService::setupIpv6Config() \sa nameservers */ + +/*! + Sets up the domain name server configuration. + + Call this method after changing the domain name server settings. + + \sa nameservers +*/ void QNetworkSettingsService::setupNameserversConfig() { Q_D(QNetworkSettingsService); @@ -294,6 +479,14 @@ void QNetworkSettingsService::setupNameserversConfig() \sa domains */ + +/*! + Sets up the domain configuration. + + Call this method after modifying the list of domain addresses. + + \sa domains +*/ void QNetworkSettingsService::setupDomainsConfig() { Q_D(QNetworkSettingsService); @@ -308,6 +501,14 @@ void QNetworkSettingsService::setupDomainsConfig() \sa proxy */ + +/*! + Sets up the network proxy configuration. + + Call this method after modifying the network proxy settings. + + \sa proxy +*/ void QNetworkSettingsService::setupNetworkSettingsProxy() { Q_D(QNetworkSettingsService); @@ -320,12 +521,23 @@ void QNetworkSettingsService::setupNetworkSettingsProxy() \sa disconnectService() */ + +/*! + Initiates the process of connecting to this network service. + + \sa disconnectService() +*/ void QNetworkSettingsService::connectService() { emit connectionStateCleared(); doConnectService(); } +/*! + Creates a connection to this network service. + + \sa connectService(), disconnectService() +*/ void QNetworkSettingsService::doConnectService() { Q_D(QNetworkSettingsService); @@ -338,6 +550,12 @@ void QNetworkSettingsService::doConnectService() \sa connectService() */ + +/*! + Disconnects this service. + + \sa connectService() +*/ void QNetworkSettingsService::disconnectService() { Q_D(QNetworkSettingsService); @@ -349,6 +567,11 @@ void QNetworkSettingsService::disconnectService() \brief Removes this service from the service cache and clears any remembered credentials. */ + +/*! + Removes this service from the service cache and clears any remembered + credentials. +*/ void QNetworkSettingsService::removeService() { Q_D(QNetworkSettingsService); diff --git a/src/networksettings/qnetworksettingsservicemodel.cpp b/src/networksettings/qnetworksettingsservicemodel.cpp index 0fe3f47..2a0a2a8 100644 --- a/src/networksettings/qnetworksettingsservicemodel.cpp +++ b/src/networksettings/qnetworksettingsservicemodel.cpp @@ -31,6 +31,36 @@ QT_BEGIN_NAMESPACE +/*! + \class QNetworkSettingsServiceModel + \inmodule QtDeviceUtilities + + \brief The QNetworkSettingsServiceModel class represents a network service. + + The network service model contains a list of network services provided by + the host. + + \sa QNetworkSettingsService +*/ + +/*! + \enum QNetworkSettingsServiceModel::Roles + + This enum type holds information about the network connection. + + \value Type + Network \l{QNetworkSettingsType::Types}{type}. + \value Name + The service set identifier (SSID) of the network. + \value SignalStrength + The signal strength of the connection. + \value Connected + Whether the connection has been established. +*/ + +/*! + Creates a network service model with the parent \a parent. +*/ QNetworkSettingsServiceModel::QNetworkSettingsServiceModel(QObject *parent) : QAbstractListModel(parent) { @@ -40,23 +70,35 @@ QNetworkSettingsServiceModel::QNetworkSettingsServiceModel(QObject *parent) m_roleNames.insert(Connected, "connected"); } +/*! + Deletes the network service model. +*/ QNetworkSettingsServiceModel::~QNetworkSettingsServiceModel() { } +/*! + Returns an array of the names of the roles in the model. +*/ QHash<int, QByteArray> QNetworkSettingsServiceModel::roleNames() const { return m_roleNames; } - +/*! + Returns the number of rows in the model with the parent \a parent. +*/ int QNetworkSettingsServiceModel::rowCount(const QModelIndex & parent) const { Q_UNUSED(parent); return m_items.count(); } +/*! + Returns the data at the index \a index in the model for the type of data + specified by \a role. +*/ QVariant QNetworkSettingsServiceModel::data(const QModelIndex & index, int role) const { if (!index.isValid()) return QVariant(); @@ -77,6 +119,9 @@ QVariant QNetworkSettingsServiceModel::data(const QModelIndex & index, int role) return QVariant(); } +/*! + Replaces placeholder data with \a item. Returns \c true on success. +*/ bool QNetworkSettingsServiceModel::replacePlaceholder(QNetworkSettingsService* item) { if (item->type() == QNetworkSettingsType::Wired) { @@ -93,6 +138,9 @@ bool QNetworkSettingsServiceModel::replacePlaceholder(QNetworkSettingsService* i return false; } +/*! + Appends \a item to the model. +*/ void QNetworkSettingsServiceModel::append(QNetworkSettingsService* item) { item->setParent(this); @@ -107,6 +155,9 @@ void QNetworkSettingsServiceModel::append(QNetworkSettingsService* item) endResetModel(); } +/*! + Inserts \a item into \a row in the model. +*/ void QNetworkSettingsServiceModel::insert(int row, QNetworkSettingsService* item) { item->setParent(this); @@ -129,6 +180,9 @@ void QNetworkSettingsServiceModel::connectStateChanges(QNetworkSettingsService* connect(wireless, &QNetworkSettingsWireless::signalStrengthChanged, this, &QNetworkSettingsServiceModel::signalStrengthChanged); } +/*! + Removes the row \a row from the model. +*/ void QNetworkSettingsServiceModel::remove(int row) { QNetworkSettingsService* item = m_items.at(row); @@ -144,6 +198,10 @@ void QNetworkSettingsServiceModel::remove(int row) endRemoveRows(); } +/*! + Removes the service specified by \a id from the model. Returns \c true if the service + was successfully removed, \c false otherwise. +*/ bool QNetworkSettingsServiceModel::removeService(const QString &id) { bool ret = false; @@ -157,11 +215,17 @@ bool QNetworkSettingsServiceModel::removeService(const QString &id) return ret; } +/*! + Marks the data on the row \a row in the model as updated. +*/ void QNetworkSettingsServiceModel::updated(int row) { dataChanged(createIndex(row, 0), createIndex(row, 0)); } +/*! + Returns the service with the name \a name. +*/ QNetworkSettingsService* QNetworkSettingsServiceModel::getByName(const QString& name) { QNetworkSettingsService* ret = nullptr; @@ -174,11 +238,17 @@ QNetworkSettingsService* QNetworkSettingsServiceModel::getByName(const QString& return ret; } +/*! + Returns the network service model. +*/ QList<QNetworkSettingsService*> QNetworkSettingsServiceModel::getModel() { return m_items; } +/*! + This signal is emitted when the connection status changes. +*/ void QNetworkSettingsServiceModel::connectionStatusChanged() { QNetworkSettingsService *s = qobject_cast<QNetworkSettingsService*>(sender()); @@ -194,6 +264,9 @@ void QNetworkSettingsServiceModel::connectionStatusChanged() } +/*! + This signal is emitted when the signal strength changes. +*/ void QNetworkSettingsServiceModel::signalStrengthChanged() { QNetworkSettingsWireless *s = qobject_cast<QNetworkSettingsWireless*>(sender()); @@ -210,17 +283,57 @@ void QNetworkSettingsServiceModel::signalStrengthChanged() //Filter model /*! + \class QNetworkSettingsServiceFilter + \inmodule QtDeviceUtilities + + \brief The QNetworkSettingsServiceFilter class represents a network service + filter. + + \sa QNetworkSettingsService +*/ + +/*! + \property QNetworkSettingsServiceFilter::type + \brief The type of the network. + + \l QNetworkSettingsType::Types +*/ + +/*! + \property QNetworkSettingsServiceFilter::wiredNetworksAvailable + \brief Whether wired networks are available. +*/ + +/*! + \fn QNetworkSettingsServiceFilter::typeChanged() + + This signal is emitted when the network type changes. +*/ + +/*! + \fn QNetworkSettingsServiceFilter::wiredNetworksAvailableChanged() + + This signal is emitted when the availability of wired networks changes. +*/ + +/*! \qmltype NetworkSettingsServiceFilter \inqmlmodule QtDeviceutilities.NetworkSettings \abstract */ +/*! + Creates a network service filter with the parent \a parent. +*/ QNetworkSettingsServiceFilter::QNetworkSettingsServiceFilter(QObject* parent) :QSortFilterProxyModel(parent), m_type(QNetworkSettingsType::Unknown) { connect(this, &QNetworkSettingsServiceFilter::typeChanged, this, &QNetworkSettingsServiceFilter::invalidate); } +/*! + Deletes the network service filter. +*/ QNetworkSettingsServiceFilter::~QNetworkSettingsServiceFilter() { @@ -234,17 +347,32 @@ QNetworkSettingsServiceFilter::~QNetworkSettingsServiceFilter() \value NetworkSettingsType.Bluetooth Bluetooth network \value NetworkSettingsType.Unknown Unknown network type */ + +/*! + Returns the service model. + + \l QNetworkSettingsType::Types +*/ QNetworkSettingsType::Types QNetworkSettingsServiceFilter::type() const { return m_type; } +/*! + \fn void QNetworkSettingsServiceFilter::setType(QNetworkSettingsType::Types type) + + Sets the service model to \a type. +*/ void QNetworkSettingsServiceFilter::setType(const QNetworkSettingsType::Types type) { m_type = type; emit typeChanged(); } +/*! + Returns whether the row \a source_row has the user role and whether it is + found in the model \a source_parent. +*/ bool QNetworkSettingsServiceFilter::filterAcceptsRow( int source_row, const QModelIndex& source_parent ) const { if (this->sourceModel()) @@ -269,6 +397,10 @@ bool QNetworkSettingsServiceFilter::filterAcceptsRow( int source_row, const QMod Returns the service at \a index in the model. */ + +/*! + Returns the service at \a row in the model. +*/ QVariant QNetworkSettingsServiceFilter::itemFromRow(const int row) const { QModelIndex idx = index(row, 0); @@ -290,6 +422,11 @@ QVariant QNetworkSettingsServiceFilter::itemFromRow(const int row) const Returns the connected service index in the model. Returns negative number if no active connection is available. */ + +/*! + Returns the connected service index in the model. + Returns negative number if no active connection is available. +*/ int QNetworkSettingsServiceFilter::activeRow() const { QNetworkSettingsServiceModel* model = qobject_cast<QNetworkSettingsServiceModel*>(sourceModel()); @@ -308,6 +445,9 @@ int QNetworkSettingsServiceFilter::activeRow() const return -1; } +/*! + Sets the availability of wired networks to \a wiredNetworksAvailable. +*/ void QNetworkSettingsServiceFilter::setWiredNetworksAvailable(bool wiredNetworksAvailable) { m_wiredNetworksAvailable = wiredNetworksAvailable; diff --git a/src/networksettings/qnetworksettingsuseragent.cpp b/src/networksettings/qnetworksettingsuseragent.cpp index cdf1e45..7458682 100644 --- a/src/networksettings/qnetworksettingsuseragent.cpp +++ b/src/networksettings/qnetworksettingsuseragent.cpp @@ -31,36 +31,110 @@ QT_BEGIN_NAMESPACE +/*! + \class QNetworkSettingsUserAgent + \inmodule QtDeviceUtilities + + \brief The QNetworkSettingsUserAgent represents the user credentials for + connecting to a network. + + The QNetworkSettingsService::connectService() method is used to connect to + a Wifi network. The network name is specified by using a service set + identifier (SSID). If no password is needed, the connection is created + immediately. QNetworkSettingsService::state property can be used to + monitor the state of the connection. + + If a password is needed, the + QNetworkSettingsUserAgent::showUserCredentialsInput() signal is emitted. + To create a connection, the password is set by using the + QNetworkSettingsUserAgent::setPassphrase() method. + + \sa QNetworkSettingsManager +*/ + +/*! + \fn QNetworkSettingsUserAgent::showUserCredentialsInput() + + This signal is emitted when user credentials are required for connecting to + a Wifi network. + + \sa QNetworkSettingsService::connectService() +*/ + +/*! + \fn QNetworkSettingsUserAgent::error() + + This signal is emitted when the connection failed due to invalid user + credentials. +*/ + +/*! + \fn QNetworkSettingsUserAgent::ready(bool cancel) + + This signal is emitted when the user has either submitted the password + for the network, or if \a cancel is \c true, cancelled the password + query. +*/ + +/*! + \fn QNetworkSettingsUserAgent::requestNextConnection() + + This signal is emitted when the network manager attempts to connect using + the next network interface in the model. +*/ + +/*! + Creates a user agent with the parent \a parent. +*/ QNetworkSettingsUserAgent::QNetworkSettingsUserAgent(QObject *parent) :QObject(parent) ,d_ptr(new QNetworkSettingsUserAgentPrivate(this)) { } +/*! + Sets the password for connecting to a Wifi network to \a passphrase. + + This method needs to be called in response to receiving the + \l showUserCredentialsInput() signal. +*/ void QNetworkSettingsUserAgent::setPassphrase(const QString &passphrase) { Q_D(QNetworkSettingsUserAgent); d->setPassphrase(passphrase); } +/*! + Cancels the user credentials input request. +*/ void QNetworkSettingsUserAgent::cancelInput() { Q_D(QNetworkSettingsUserAgent); d->cancel(); } +/*! + Returns the password of the user agent. +*/ QString QNetworkSettingsUserAgent::passphrase() const { Q_D(const QNetworkSettingsUserAgent); return d->passphrase(); } +/*! + Sets the name of the network to \a ssid and the password of the user agent + to \a passphrase. +*/ void QNetworkSettingsUserAgent::setSsidAndPassphrase(const QString &ssid, const QString &passphrase) { Q_D(QNetworkSettingsUserAgent); d->setSsidAndPassphrase(ssid, passphrase); } +/*! + Clears the connection state. +*/ void QNetworkSettingsUserAgent::clearConnectionState() { Q_D(QNetworkSettingsUserAgent); diff --git a/src/timedatesettings/systemtime.cpp b/src/timedatesettings/systemtime.cpp index ce97899..3f3520b 100644 --- a/src/timedatesettings/systemtime.cpp +++ b/src/timedatesettings/systemtime.cpp @@ -31,6 +31,29 @@ QT_BEGIN_NAMESPACE +/*! + \class SystemTime + \inmodule QtDeviceUtilities + \brief The SystemTime class manages the system date and time. +*/ + +/*! + \property SystemTime::timeZone + \brief Holds the current time zone string. +*/ + +/*! + \property SystemTime::ntp + + Holds whether the system time is synchronized using NTP (Network + Time Protocol). +*/ + +/*! + \property SystemTime::time + \brief Holds the current date and time. +*/ + SystemTime::SystemTime(QObject *parent) : QObject(parent) ,d_ptr(new SystemTimePrivate(this)) diff --git a/src/timedatesettings/timezonemodel.cpp b/src/timedatesettings/timezonemodel.cpp index 8983a49..eec7450 100644 --- a/src/timedatesettings/timezonemodel.cpp +++ b/src/timedatesettings/timezonemodel.cpp @@ -35,6 +35,37 @@ QT_BEGIN_NAMESPACE +/*! + \class TimezoneItem + \inmodule QtDeviceUtilities + \brief The TimezoneItem class represents a time zone. +*/ + +/*! + \property TimezoneItem::id + \brief Holds the IANA time zone ID. + + \sa QTimeZone::id(), {IANA Time Zone IDs} +*/ + +/*! + \property TimezoneItem::name + \brief Holds the localized display name of the time zone. + + \sa QTimeZone::displayName() +*/ + +/*! + \property TimezoneItem::country + \brief Holds the name of the country for the time zone. + + \sa QTimeZone::country() +*/ + +/*! + Creates a time zone item with the IANA time zone ID \a id and parent + \a parent. +*/ TimezoneItem::TimezoneItem(const QByteArray& id, QObject *parent) :QObject(parent) { @@ -44,21 +75,74 @@ TimezoneItem::TimezoneItem(const QByteArray& id, QObject *parent) m_id = QString::fromUtf8(id); } +/*! + Returns the localized display name of the time zone. + + \sa QTimeZone::displayName() +*/ QString TimezoneItem::name() const { return m_name; } +/*! + Returns the name of the country for the time zone. + + \sa QTimeZone::country() +*/ QString TimezoneItem::country() const { return m_country; } +/*! + Returns the IANA time zone ID. + + \sa QTimeZone::id(), {IANA Time Zone IDs} +*/ QString TimezoneItem::id() const { return m_id; } +/*! + \class TimezoneModel + \inmodule QtDeviceUtilities + \brief The TimezoneModel class provides a model for the available time + zones. + + This class can be used as the model in a view that lists the available time + zones. +*/ + +/*! + \enum TimezoneModel::Roles + + This enum type holds information about a time zone. + + \value Name + Localized display name of the time zone + \value Country + Name of the country for the time zone + \value Id + IANA time zone ID +*/ + +/*! + \fn QList<TimezoneItem *> TimezoneModel::getModel() const + + Returns the time zone model for a time zone item. +*/ + +/*! + \fn TimezoneModel::ready() + + This signal is emitted when the model is ready. +*/ + +/*! + Creates a new time zone model with the parent \a parent. +*/ TimezoneModel::TimezoneModel(QObject *parent) : QAbstractListModel(parent) { @@ -74,6 +158,9 @@ TimezoneModel::TimezoneModel(QObject *parent) connect(watcher, SIGNAL(finished()), this, SIGNAL(ready())); } +/*! + Creates the time zone model \a model. +*/ void TimezoneModel::generateModel(TimezoneModel* model) { QList<QByteArray> ids = QTimeZone::availableTimeZoneIds(); @@ -84,6 +171,9 @@ void TimezoneModel::generateModel(TimezoneModel* model) } } +/*! + Adds the time zone item \a item to the time zone model. +*/ void TimezoneModel::addNewItem(QObject* item) { beginInsertRows(QModelIndex(), m_items.count(), m_items.count()); @@ -93,23 +183,35 @@ void TimezoneModel::addNewItem(QObject* item) endInsertRows(); } +/*! + Deletes the time zone model. +*/ TimezoneModel::~TimezoneModel() { qDeleteAll(m_items); } +/*! + Returns an array of the names of the roles in the model. +*/ QHash<int, QByteArray> TimezoneModel::roleNames() const { return m_roleNames; } - +/*! + Returns the number of rows in the model with the parent \a parent. +*/ int TimezoneModel::rowCount(const QModelIndex & parent) const { Q_UNUSED(parent); return m_items.count(); } +/*! + Returns the data at the index \a index in the model for the type of data + specified by \a role. +*/ QVariant TimezoneModel::data(const QModelIndex & index, int role) const { if (!index.isValid()) return QVariant(); |