From d7820ada21fb29b273a68a5ea69477ef5763d5de Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 23 Aug 2020 10:28:59 +0200 Subject: More cleanup; drop Qt bearer management on Qt 5.15+ Qt 5.15 deprecates bearer management. --- lib/networkaccessmanager.cpp | 5 +++-- lib/util.cpp | 30 +++++++++--------------------- 2 files changed, 12 insertions(+), 23 deletions(-) (limited to 'lib') diff --git a/lib/networkaccessmanager.cpp b/lib/networkaccessmanager.cpp index 8ee080bf..b9037bcc 100644 --- a/lib/networkaccessmanager.cpp +++ b/lib/networkaccessmanager.cpp @@ -50,11 +50,12 @@ void NetworkAccessManager::clearIgnoredSslErrors() static NetworkAccessManager* createNam() { auto nam = new NetworkAccessManager(QCoreApplication::instance()); - // See #109. Once Qt bearer management gets better, this workaround - // should become unnecessary. +#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0)) + // See #109; in newer Qt, bearer management is deprecated altogether nam->connect(nam, &QNetworkAccessManager::networkAccessibleChanged, [nam] { nam->setNetworkAccessible(QNetworkAccessManager::Accessible); }); +#endif return nam; } diff --git a/lib/util.cpp b/lib/util.cpp index 61661de8..797f6d69 100644 --- a/lib/util.cpp +++ b/lib/util.cpp @@ -126,32 +126,30 @@ QString Quotient::serverPart(const QString& mxId) % ServerPartRegEx % ")$"; static QRegularExpression parser( re, - QRegularExpression::UseUnicodePropertiesOption); // Because Asian - // digits + QRegularExpression::UseUnicodePropertiesOption); // Because Asian digits return parser.match(mxId).captured(1); } // Tests for function_traits<> -#ifdef Q_CC_CLANG -# pragma clang diagnostic push -# pragma ide diagnostic ignored "OCSimplifyInspection" -#endif using namespace Quotient; -int f(); -static_assert(std::is_same, int>::value, +int f_(); +static_assert(std::is_same, int>::value, "Test fn_return_t<>"); -void f1(int, QString); -static_assert(std::is_same, QString>::value, +void f1_(int, QString); +static_assert(std::is_same, QString>::value, "Test fn_arg_t<>"); struct Fo { int operator()(); + static constexpr auto l = [] { return 0.0f; }; }; static_assert(std::is_same, int>::value, "Test return type of function object"); +static_assert(std::is_same, float>::value, + "Test return type of lambda"); struct Fo1 { void operator()(int); @@ -159,20 +157,10 @@ struct Fo1 { static_assert(std::is_same, int>(), "Test fn_arg_t defaulting to first argument"); -#if (!defined(_MSC_VER) || _MSC_VER >= 1910) -static auto l = [] { return 1; }; -static_assert(std::is_same, int>::value, - "Test fn_return_t<> with lambda"); -#endif - template -QString ft(T&&) +static QString ft(T&&) { return {}; } static_assert(std::is_same)>, QString&&>(), "Test function templates"); - -#ifdef Q_CC_CLANG -# pragma clang diagnostic pop -#endif -- cgit v1.2.3