summaryrefslogtreecommitdiffstats
path: root/src/plugins/networkinformation/networklistmanager
Commit message (Collapse)AuthorAgeFilesLines
* QNetworkInfo[win]: Explicitly link with oleaut32 for MINGW tooMark Brand2024-04-051-1/+1
| | | | | | | | | | | | | Following up on 2 commits that fixed static linking for MSVC but left out MINGW: 230c53ad9d7046e61b37ce63a6bc68449393bb7b d9820b02072b27f830b389e503467c8220679cba Pick-to: 6.6 6.7 Fixes: QTBUG-114243 Change-Id: I12853355ffa1a62acce15ff660478f618c42e0a6 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* QNetworkInfo[win]: Advertise Metered featureMårten Nordheim2023-11-061-0/+1
| | | | | | | | | | | | I forgot to add this to the features list when adding support for it. Amends d2c5494c3d5412bfc1dc3e819e88a636407025fc Pick-to: 6.6 6.5 Fixes: QTBUG-118741 Change-Id: Ieabf086ef66777e6178476934b88448ad88bc738 Reviewed-by: Erik Verbruggen <erik.verbruggen@me.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* cmake: un-special case clang-cl for runtimeobjectYuhang Zhao2023-10-091-1/+1
| | | | | | | | clang-cl can correctly handle runtimeobject.lib for quite some time already, no need to special case for it anymore. Change-Id: I87aa98134ad847808b3129c5629ccf8fa1dce253 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Network plugins: include mocsMårten Nordheim2023-07-071-0/+2
| | | | | | Change-Id: I7a64d636f5588bda3633cbb3fb6213232c7654a4 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QNetworkInfo[win]: Explicitly link with oleaut32Mårten Nordheim2023-06-131-0/+1
| | | | | | | | | | | | Declaring it as an explicit dependency should hopefully make the compilers order the object-files to be linked in the correct order. Task-number: QTBUG-114243 Pick-to: 6.6 6.5 Change-Id: I723fee468e58786f66d1bba50bc4086beb50adb1 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* QNetworkInformation[Win]: Improve WinRT exceptions handlingVladimir Belyavsky2023-04-181-3/+9
| | | | | | | | | | - handle only winrt::hresult_error exceptions, as this is the only reported cases, so we don't need ellipsis there - print relevant warnings Pick-to: 6.5 Change-Id: Ibf18a7eab7862e2c20f5729545387ddc7ca42952 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QNetworkInformation[Win]: Catch potential WinRT exceptionsVladimir Belyavsky2023-04-141-10/+16
| | | | | | | | | | Some Windows SDKs seem to throw an exception from winrt::check_hresult() We need to handle this accordingly. Catch the exception and print relevant warning. Fixes: QTBUG-110408 Pick-to: 6.5 Change-Id: I1434ec425f0d0e597308b53f25f4f15049640060 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Introduce qt_winrtbase_p.hOliver Wolff2023-01-232-11/+2
| | | | | | | | | | | | | | Due to a bug in earlier Windows SDKs developers have copy paste a workaround whenever they are including winrt/base.h. In addition to that our usage winrt API also forces them to include qfactorycacheregistration_p.h whenever they include that file. To make things easier all that magic can now be done with one single include of qt_winrtbase_p.h. Pick-to: 6.4 Change-Id: Ic6a80d6d3723af381cf0ecc0f0ab43c2e6839a7d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Add missing header guardsFriedemann Kleint2023-01-121-0/+5
| | | | | | | Task-number: QTBUG-109394 Pick-to: 6.5 6.4 6.2 Change-Id: Idc5b0057d41186c8dfd7e752fe819ebebc6f8859 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* networklistmanager: allow building with LLVM-MinGWCristian Adam2022-12-032-1/+2
| | | | | | | | At https://github.com/mstorsjo/llvm-mingw/issues/307 we can see that LLVM-MinGW is able to build qtbase with winrt headers and cxx20 feature. Change-Id: Ib4b5df7481f684ebdb26cbc4246bdf86ff3dd648 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Windows: centralize how we handle error messagesYuhang Zhao2022-11-162-14/+10
| | | | | | | | | | | | | | | | Currently QtBase contains multiple implementation of how to get the Win32 and COM error messages, and they are almost exactly the same, what's worse, Qt already has a private QSystemError class to do such things, so we are re-inventing the wheel in many places. This patch removes all other custom error message implementations besides the QSystemError one. And since there are a lot of places need the COM error message, move the implementation to QSystemError so that it can handle both Win32 error and COM error. Since I'm touching these lines anyway, break them into short lines if they are above the length limit. Change-Id: I1067c874011800303f0f114b5cb8830ac6810fc0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QNetworkInformation[win]: Capture another potential exceptionMårten Nordheim2022-11-151-1/+6
| | | | | | | | | | As reported by a user. Fixes: QTBUG-108382 Pick-to: 6.4 Change-Id: Ic94c65d533edd84c8fda5d713d9579a9492b88ae Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QNetworkInformation[Win]: Fix potential use-after/during-freeMårten Nordheim2022-11-093-12/+26
| | | | | | | | | | | | | | | | | | | | The WinRT NetworkStatusChanged callback may happen during or slightly before we unregister our token, which we usually follow up by destroying the object. So we have to avoid potentially doing work on a deallocated object. Do this using the old QPointer-trick. Neither me nor reporter can reproduce it locally, so this is only a best-measure. Further problems may be that the storage for the lambda has already been destroyed and repurposed, in which case the pointer may be valid, but junk, which would lead to another crash. But this is unavoidable as long as MS does not synchronize callbacks with (un)registering new callbacks. To attempt combatting this we hold our own lock around unregistration and the "meat" of the callback. Pick-to: 6.4 6.4.1 Fixes: QTBUG-108218 Change-Id: Iacf8b8f458cca3152ff395e9a38e8df193534f46 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QNetworkInformation[Win]: Catch potential exceptionsMårten Nordheim2022-11-042-2/+15
| | | | | | | | | | | | | | Some Windows SDKs seem to throw an exception (sometimes?) when calling ConnectionProfile::NetworkAdapter. Catch the exception and ignore it, we would return Unknown anyway. And just in case it is needed, do the same for GetConnectionCost. This requires enabling exceptions for the plugin. Fixes: QTBUG-108156 Pick-to: 6.4 6.4.1 Change-Id: Ie6c5adb3715578aa94ef3391afae79d9aecdc5d3 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Proper clearing of WinRT factory cacheAndreas Buhr2022-10-312-0/+2
| | | | | | | | | | | | | | | | | | | If we use winrt's factories we have to make sure to to clear the factory cache when one of our dlls is unloaded or we will run into dangling factory entries which might result in crashes. So we have to make sure that winrt::clear_factory_cache is called on every dll unload. In order not to increase compile times and dependencies too much qfactorycacheregistration_p.h needs to be included in Qt code whenever we use winrt's factory cache. A rule of thumb being: Include qfactorycacheregistration_p.h whenever including winrt/base.h. Other Qt modules which use winrt's factories need to be updated too. Fixes: QTBUG-103611 Pick-to: 6.2 6.4 Change-Id: I7ab24e4b18bffaca653c5b7f56a66ce99212e339 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add QComHelper class for dealing with COM on WindowsTor Arne Vestbø2022-08-291-10/+7
| | | | | | | | | | | | | | | Unifies our approach to calling CoInitializeEx and CoUninitialize, removing a lot of boilerplate in the process, and also fixes a few bugs where we would incorrectly balance our calls to CoInitializeEx and CoUninitialize. The optimistic approach of qfilesystemengine_win.cpp of calling CoCreateInstance without initializing the COM library explicitly has been removed, as calling CoInitializeEx should be a noop in the situation where it's already been loaded. Change-Id: I9e2ec101678c2ebb9946504b5e8034e58f1bb56a Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Simplify QNetworkListManagerNetworkInformationBackend's COM handlingTor Arne Vestbø2022-08-261-17/+6
| | | | | | | | | | | The class used to be implicitly movable to a different thread, but this is no longer the case, so we don't need to initialize and uninitialize the COM library in start() and stop(). A qFatal has been added to ensure we detect if this will be required again. Change-Id: Ib22fe0bdcd5cb96f05632b09803c5de8ff43279a Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove superfluous clang preprocessor check for cpp/winrtOliver Wolff2022-08-263-13/+9
| | | | | | | | | The cpp/winrt configure test fails if clang is being used so there is no need to explicitly check for the compiler. Change-Id: Ifb2cb792cf3ea2d2ff09be6e47d741f09aec765f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-231-1/+1
| | | | | | | Task-number: QTBUG-105718 Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QtBase: Windows: Replace some deprecated API usagesYuhang Zhao2022-08-031-2/+2
| | | | | | | | | | | | Microsoft recommends to use CoInitializeEx() and SetWindowLongPtr()/GetWindowLongPtr() in new code. Use COINIT_DISABLE_OLE1DDE to avoid overhead of initializing and using obsolete technology. Pick-to: 6.4 Change-Id: I9d16943e864d4487dd4f46fd9325579c298c52b9 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Add license headers to cmake filesLucie Gérard2022-08-031-0/+3
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-163-114/+6
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* configure: Check for basic cpp/winrt supportOliver Wolff2022-02-011-1/+1
| | | | | | | | | | | | | | Some configurations (like MSVC2019 with c++20 on Windows 10) fail to compile winrt/cpp headers as these include experimental coroutines unconditionally. In these cases we can fall back to the legacy implementation. Pick-to: 6.2 6.3 Change-Id: Ibd574995f8ca1f865bbcdabede1ffcd0c340022f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QNI: Windows support for the isMetered APIMårten Nordheim2021-11-083-18/+36
| | | | | | | | | As a drive-by: fix some improper indentation Task-number: QTBUG-91024 Change-Id: I29e04aff3638dfb2aab9d40650c55a48baba7222 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QNI: Add a convenience method for loading the default pluginMårten Nordheim2021-10-221-3/+7
| | | | | | | | | We have some official plugins, we may as well treat them as default and give a convenient function which loads those. Change-Id: I6251c77ac042b795bcf24b86e510e960ee4bab54 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QNI: Windows: support transportMediumMårten Nordheim2021-10-204-1/+102
| | | | | | | | | | | | | Brings support for transportMedium to NetworkListManager backend. Which, with this patch, also uses winrt API because there is no equivalent API available in NLM. This API is so much nicer than NLM... Task-number: QTBUG-91023 Change-Id: I360a3a197caa2aa4848c8f768aea6a09a68b0ed5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* QNI: Windows: Remove unneeded friendMårten Nordheim2021-10-081-2/+0
| | | | | | Change-Id: I5d66a67a5c16a479f62b9f43cb769d5ee5f66b60 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QNI: NetworkListManager: Extract the Events classMårten Nordheim2021-10-074-186/+285
| | | | | | | Moving the class out makes it easier to navigate the code Change-Id: I8de67641512a7dbbf6446cdca9d8dea79a63c217 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QNetworkInfo(Win): cleanupsMårten Nordheim2021-09-201-4/+3
| | | | | | | | | One signal emission was not labelled emit. Removed some unnecessary braces Change-Id: I1c0adde869e559056e60671619bfca33b1966d1e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* TLS plugins: Prefix with 'q'Mårten Nordheim2021-08-301-1/+1
| | | | | | | | For consistency with other plugins. Pick-to: 6.2 Change-Id: I45507389a42e645c94f1ca3f32262a2181f282f7 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* CMake: Rename qt6_add_plugin TYPE option to PLUGIN_TYPEAlexandru Croitor2021-08-061-1/+1
| | | | | | | | | | | | | The intention is to remove TYPE as a keyword completely before 6.2.0 release, but in case if that's not possible due to the large amount of repositories and examples, just print a deprecation warning for now and handle both TYPE and PLUGIN_TYPE. Task-number: QTBUG-95170 Pick-to: 6.2 Change-Id: If0c18345483b9254b0fc21120229fcc2a2fbfbf5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix incorrect default plugin conditions on WindowsAlexandru Croitor2021-07-221-1/+1
| | | | | | | | | | | | | | The correct variable to check is WIN32 rather than WINDOWS. This affects which plugins get automatically linked in a static Qt build. Amends a3b58a7844f77bd416fad8307f8333ff7c0efacf Amends d385158d5213ef568b7629e2aa4a818016bbffac Pick-to: 6.1 6.2 Fixes: QTBUG-95283 Change-Id: Idf78c78a1029f4d13fb460c07bef3d2669e55b09 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* CMake: Don't give plugins PUBLIC usage requirements part 2Alexandru Croitor2021-07-151-1/+1
| | | | | | | | | | | | | Plugins shouldn't have public usage requirements. Amends 434ada8dcb6132b3a597ea56b57a66c627f51728 Pick-to: 6.2 Task-number: QTBUG-90819 Change-Id: Iffb3def07ea428b1c3c5b9873e259a4d5168b7a1 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QNetworkInformation: Rename the plugins and typeMårten Nordheim2021-06-112-0/+432
To better match other plugins in Qt Pick-to: 6.2 Change-Id: I6ab19603f13c80a8afe4fe69f64669559a0eea15 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Yuhang Zhao <2546789017@qq.com>