In 6c565689 the HostAddress was refactored. A check for isV6 when
creating a QHostAddress was removed. However, the QHostAddress
determines the (IPv4 vs IPv6) distinction at construction time.
This resulted in some regressions both visually and functional.
This commit reintroduces the distinction.
Fixes#6349
The way this union was accessed is not covered by the C++ standard and
was therefore undefined behavior. Therefore, the code was rewritten to
stick to standard C++.
The "Addresses" field in the ServerItem tooltip shows both ipv4 and ipv6
addresses. The order of addresses in this field is not determined.
In the wild it is randomized. As discussed in #5696 it is better to implement
a concrete ordering to prevent user confusion. To further improve the
readability of the addresses we split the addresses field in two fields
called "IPv4 address" and "IPv6 address". The ipv4 address is now always
shown above the ipv6 address.
Implements #5696
Co-Authored-By: Thomas Pawelek <thomas.pawelek@stud.uni-hannover.de>
Apparently the first commit (59ae429972)
did not include all files.
Furthermore the used script tended to produce funny results in certain
cases. This has been fixed and as a result thereof a few more changes
were made in this second run.
In b263b91340 I exchanged QString::sprintf
with QString::asprintf as the former was declared deprecated from Qt 5.5
onwards. I forgot to check the docs though. If I had, I would have
noticed that in contrast to sprintf, asprintf is a static function which
returns the assembled String (sprintf wrote it to the object it was
being called on). Thus I also have to assign the return value of
asprintf to a variable in order to have it have an effect.
This commit adds all the missing includes when the PCH header is not used.
Also, some includes are reordered and/or made consistent (e.g. "#include <QtEndian>" -> "#include <QtCore/QtEndian>").
According to Qt's documentation the PCH header doesn't need to be included.
From https://doc.qt.io/qt-5/qmake-precompiledheaders.html:
"To make your project use precompiled headers, you only need to define the PRECOMPILED_HEADER variable in your project file."
"qmake will handle the rest, to ensure the creation and use of the precompiled header file. You do not need to include the precompiled header file in HEADERS, as qmake will do this if the configuration supports precompiled headers."