Commit b90f6818 authored by Volker Krause's avatar Volker Krause

Drop Qt4 support

GammaRay is dropping that as well now, which was the only remaining user
of this.
parent f625b9c2
......@@ -18,12 +18,17 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 11)
include(ECMGenerateHeaders)
include(ECMPoQmTools)
include(ECMSetupVersion)
include(ECMQueryQmake)
include(ECMGeneratePriFile)
include(FeatureSummary)
include(GenerateExportHeader)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings)
enable_testing()
......@@ -33,61 +38,20 @@ ecm_setup_version(PROJECT
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kuserfeedback_version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KUserFeedbackConfigVersion.cmake"
)
#
# Compiler & linker settings
#
if(CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wall -std=c++0x -pedantic")
endif()
#
# Dependencies
#
# try Qt5 first, and prefer that (if found), but only if not disabled via option
if(NOT ENFORCE_QT4_BUILD)
find_package(Qt5Core QUIET NO_MODULE)
find_package(QmlLint)
# do not include in the Qt4 path, these calls find_package(Qt5)
include(ECMQueryQmake)
include(ECMGeneratePriFile)
include(KDEInstallDirs)
include(KDECMakeSettings)
else()
set(Qt5Core_FOUND FALSE)
find_package(Qt5 5.4 NO_MODULE REQUIRED COMPONENTS Core Network)
find_package(Qt5 NO_MODULE QUIET OPTIONAL_COMPONENTS Widgets Charts Test Qml Svg PrintSupport)
find_package(QmlLint)
if (NOT CMAKE_CROSSCOMPILING)
find_package(Qt5 NO_MODULE QUIET OPTIONAL_COMPONENTS Help)
endif()
if(Qt5Core_FOUND)
set_package_properties(Qt5Core PROPERTIES TYPE REQUIRED)
find_package(Qt5 NO_MODULE REQUIRED COMPONENTS Network)
find_package(Qt5 NO_MODULE QUIET OPTIONAL_COMPONENTS Widgets Charts Test Qml Svg PrintSupport)
if (NOT CMAKE_CROSSCOMPILING)
find_package(Qt5 NO_MODULE QUIET OPTIONAL_COMPONENTS Help)
endif()
set_package_properties(Qt5 PROPERTIES URL "http://qt-project.org/")
set_package_properties(Qt5Widgets PROPERTIES TYPE RECOMMENDED PURPOSE "Required for feedback configuration and notification widgets.")
set_package_properties(Qt5Charts PROPERTIES TYPE RECOMMENDED PURPOSE "Required for UserFeedbackConsole.")
# Qt4
else()
set(QT_USE_IMPORTED_TARGETS true)
find_package(Qt4 4.8.0 REQUIRED QtCore QtNetwork QtGui QtTest)
include(${QT_USE_FILE})
set_package_properties(Qt4 PROPERTIES URL "http://qt-project.org/")
# C++11/Qt5 compatibility
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FI\"${CMAKE_SOURCE_DIR}\\src\\compat\\qt4compat.h\"")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include \"${CMAKE_SOURCE_DIR}/src/compat/qt4compat.h\"")
endif()
include(Qt4ECMStub)
# Qt4 moc limitation workaround (Qt4 moc cannot evaluate QT_VERSION preprocessor conditionals
add_definitions(-DQT4_MOC_WORKAROUND)
endif()
set_package_properties(Qt5 PROPERTIES URL "http://qt-project.org/")
set_package_properties(Qt5Widgets PROPERTIES TYPE RECOMMENDED PURPOSE "Required for feedback configuration and notification widgets.")
set_package_properties(Qt5Charts PROPERTIES TYPE RECOMMENDED PURPOSE "Required for UserFeedbackConsole.")
# debug suffixes for qmake compatibility
if(WIN32)
......@@ -122,10 +86,8 @@ add_subdirectory(src)
if (BUILD_TESTING)
add_subdirectory(autotests)
endif()
if(Qt5Core_FOUND)
add_subdirectory(tests)
add_subdirectory(docs)
endif()
add_subdirectory(tests)
add_subdirectory(docs)
#
# CMake package config file generation
......
@PACKAGE_INIT@
if(@Qt5Core_FOUND@)
find_package(Qt5 @Qt5Core_VERSION_MAJOR@.@Qt5Core_VERSION_MINOR@ NO_MODULE REQUIRED COMPONENTS Core Network)
find_package(Qt5 @Qt5Core_VERSION_MAJOR@.@Qt5Core_VERSION_MINOR@ NO_MODULE COMPONENTS Widgets)
else()
find_package(Qt4 @QT_VERSION_MAJOR@.@QT_VERSION_MINOR@)
endif()
find_package(Qt5 @Qt5Core_VERSION_MAJOR@.@Qt5Core_VERSION_MINOR@ NO_MODULE REQUIRED COMPONENTS Core Network)
find_package(Qt5 @Qt5Core_VERSION_MAJOR@.@Qt5Core_VERSION_MINOR@ NO_MODULE COMPONENTS Widgets)
include("${CMAKE_CURRENT_LIST_DIR}/KUserFeedbackTarget.cmake")
......@@ -10,12 +10,7 @@ endif()
function(uf_add_test _file)
get_filename_component(_name ${_file} NAME_WE)
add_executable(${_name} ${_file})
if(Qt5Core_FOUND)
target_link_libraries(${_name} Qt5::Test ${ARGN})
else()
list(REMOVE_ITEM ARGN Qt5::Gui)
target_link_libraries(${_name} ${QT_QTTEST_LIBRARY} ${QT_QTGUI_LIBRARY} ${ARGN})
endif()
target_link_libraries(${_name} Qt5::Test ${ARGN})
add_test(NAME ${_name} COMMAND ${_name})
endfunction()
......
......@@ -31,9 +31,7 @@
#include <QtTest/qtest.h>
#include <QObject>
#include <QSettings>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QStandardPaths>
#endif
using namespace KUserFeedback;
......@@ -64,9 +62,7 @@ private slots:
{
QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org"));
QCoreApplication::setOrganizationName(QStringLiteral("KDE"));
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QStandardPaths::setTestModeEnabled(true);
#endif
}
void testPlatformInfoSource()
......@@ -100,9 +96,7 @@ private slots:
const auto scr = v.toMap();
QVERIFY(scr.contains(QLatin1String("height")));
QVERIFY(scr.contains(QLatin1String("width")));
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QVERIFY(scr.contains(QLatin1String("dpi")));
#endif
}
}
......@@ -254,13 +248,11 @@ private slots:
void testQPAInfoSource()
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QPAInfoSource src;
QVERIFY(!src.description().isEmpty());
const auto m = src.data().toMap();
QVERIFY(m.contains(QLatin1String("name")));
QVERIFY(!m.value(QLatin1String("name")).toString().isEmpty());
#endif
}
};
......
......@@ -25,9 +25,7 @@
#include <QtTest/qtest.h>
#include <QObject>
#include <QSlider>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QStandardPaths>
#endif
using namespace KUserFeedback;
......@@ -37,9 +35,7 @@ class FeedbackConfigTest : public QObject
private slots:
void initTestCase()
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QStandardPaths::setTestModeEnabled(true);
#endif
}
void testTelemetrySettings()
......
......@@ -21,9 +21,7 @@
#include <QDebug>
#include <QtTest/qtest.h>
#include <QObject>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QStandardPaths>
#endif
using namespace KUserFeedback;
......@@ -33,9 +31,7 @@ class OpenGLInfoSourceTest : public QObject
private slots:
void initTestCase()
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QStandardPaths::setTestModeEnabled(true);
#endif
}
void testOpenGLInfoSource()
......@@ -45,7 +41,6 @@ private slots:
QVERIFY(m.contains(QLatin1String("type")));
const auto type = m.value(QLatin1String("type")).toString();
QVERIFY(!type.isEmpty());
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QVERIFY(type == QLatin1String("GL") || type == QLatin1String("GLES"));
QVERIFY(m.contains(QLatin1String("vendor")));
......@@ -58,7 +53,6 @@ private slots:
QVERIFY(!m.value(QLatin1String("vendorVersion")).toString().isEmpty());
QVERIFY(m.contains(QLatin1String("glslVersion")));
QVERIFY(!m.value(QLatin1String("glslVersion")).toString().isEmpty());
#endif
}
void testParseGLVersion_data()
......
......@@ -25,9 +25,7 @@
#include <QObject>
#include <QSettings>
#include <QSignalSpy>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QStandardPaths>
#endif
using namespace KUserFeedback;
......@@ -40,9 +38,7 @@ private slots:
QCoreApplication::setOrganizationName(QStringLiteral("KDE"));
QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org"));
QCoreApplication::setApplicationName(QStringLiteral("providertest"));
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QStandardPaths::setTestModeEnabled(true);
#endif
}
void init()
......@@ -97,7 +93,6 @@ private slots:
void testEncouragement()
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
{
QSettings s(QCoreApplication::organizationName(), QStringLiteral("UserFeedback.org.kde.providertest"));;
s.beginGroup(QLatin1String("UserFeedback"));
......@@ -125,12 +120,10 @@ private slots:
p.setApplicationUsageTimeUntilEncouragement(0);
QVERIFY(!spy.wait(10));
}
#endif
}
void testEncouragementDelay()
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
{
QSettings s(QCoreApplication::organizationName(), QStringLiteral("UserFeedback.org.kde.providertest"));;
s.beginGroup(QLatin1String("UserFeedback"));
......@@ -148,12 +141,10 @@ private slots:
QVERIFY(spy.wait(1200));
QCOMPARE(spy.count(), 1);
}
#endif
}
void testNoEncouragementWithAllFeedbackEnabled()
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
{
QSettings s(QCoreApplication::organizationName(), QStringLiteral("UserFeedback.org.kde.providertest"));;
s.beginGroup(QLatin1String("UserFeedback"));
......@@ -173,12 +164,10 @@ private slots:
QVERIFY(!spy.wait(10));
QCOMPARE(spy.count(), 0);
}
#endif
}
void testEncouragementRepetition()
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
{
QSettings s(QCoreApplication::organizationName(), QStringLiteral("UserFeedback.org.kde.providertest"));;
s.beginGroup(QLatin1String("UserFeedback"));
......@@ -215,12 +204,10 @@ private slots:
p.setEncouragementInterval(1);
QVERIFY(!spy.wait(10));
}
#endif
}
void testGlobalEncouragementCoordination()
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
{
QSettings s(QCoreApplication::organizationName(), QStringLiteral("UserFeedback.org.kde.providertest"));;
s.beginGroup(QLatin1String("UserFeedback"));
......@@ -258,7 +245,6 @@ private slots:
p.setEncouragementInterval(1);
QVERIFY(!spy.wait(100));
}
#endif
}
void testMultipleProviders()
......@@ -343,7 +329,6 @@ private slots:
Provider p2;
QVERIFY(!p2.isEnabled());
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
// check encouragements are disabled
{
QSettings s(QCoreApplication::organizationName(), QStringLiteral("UserFeedback.org.kde.providertest"));;
......@@ -362,7 +347,6 @@ private slots:
p.setEncouragementInterval(1);
QVERIFY(!spy.wait(100));
}
#endif
}
};
......
......@@ -23,9 +23,7 @@
#include <QObject>
#include <QSettings>
#include <QStandardItemModel>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QStandardPaths>
#endif
using namespace KUserFeedback;
......@@ -37,9 +35,7 @@ private slots:
{
QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org"));
QCoreApplication::setOrganizationName(QStringLiteral("KDE"));
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QStandardPaths::setTestModeEnabled(true);
#endif
}
void testPropertyRatioSource()
......
......@@ -23,9 +23,7 @@
#include <QObject>
#include <QSettings>
#include <QSignalSpy>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QStandardPaths>
#endif
#include <QUuid>
using namespace KUserFeedback;
......@@ -41,9 +39,7 @@ private slots:
QCoreApplication::setOrganizationName(QStringLiteral("KDE"));
QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org"));
QCoreApplication::setApplicationName(QStringLiteral("surveyprovidertest"));
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QStandardPaths::setTestModeEnabled(true);
#endif
}
void testSurveySelect()
......
# The current ECM version of this depends on Qt5
function(ecm_generate_pri_file)
endfunction()
# install locations depend on ECMQueryQMake, which depends on Qt5
set(KDE_INSTALL_BINDIR "bin")
set(KDE_INSTALL_LIBDIR "lib")
set(KDE_INSTALL_INCLUDEDIR "include")
set(KDE_INSTALL_CMAKEPACKAGEDIR "${KDE_INSTALL_LIBDIR}/cmake")
set(KDE_INSTALL_TARGETS_DEFAULT_ARGS
RUNTIME DESTINATION ${KDE_INSTALL_BINDIR}
LIBRARY DESTINATION ${KDE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${KDE_INSTALL_LIBDIR} COMPONENT Devel
BUNDLE DESTINATION ${KDE_INSTALL_BUNDLEDIR}
)
......@@ -34,9 +34,4 @@ add_library(KUserFeedbackCommon STATIC
)
target_include_directories(KUserFeedbackCommon PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/..>")
if(Qt5Core_FOUND)
target_link_libraries(KUserFeedbackCommon LINK_PRIVATE Qt5::Core)
else()
target_link_libraries(KUserFeedbackCommon LINK_PRIVATE ${QT_QTCORE_LIBS})
set_target_properties(KUserFeedbackCommon PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(KUserFeedbackCommon LINK_PRIVATE Qt5::Core)
......@@ -68,7 +68,6 @@ bool SurveyTargetExpressionEvaluator::evaluate(SurveyTargetExpression* expressio
return lhs == rhs;
case SurveyTargetExpression::OpNotEqual:
return lhs != rhs;
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
case SurveyTargetExpression::OpGreater:
return lhs > rhs;
case SurveyTargetExpression::OpGreaterEqual:
......@@ -77,16 +76,6 @@ bool SurveyTargetExpressionEvaluator::evaluate(SurveyTargetExpression* expressio
return lhs < rhs;
case SurveyTargetExpression::OpLessEqual:
return lhs <= rhs;
#else
case SurveyTargetExpression::OpGreater:
return lhs.toDouble() > rhs.toDouble();
case SurveyTargetExpression::OpGreaterEqual:
return lhs.toDouble() >= rhs.toDouble();
case SurveyTargetExpression::OpLess:
return lhs.toDouble() < rhs.toDouble();
case SurveyTargetExpression::OpLessEqual:
return lhs.toDouble() <= rhs.toDouble();
#endif
default:
break;
}
......
/*
Copyright (C) 2016 Volker Krause <vkrause@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KUSERFEEDBACK_QT4COMPAT_H
#define KUSERFEEDBACK_QT4COMPAT_H
/** @file qt4compat.h
* Compatibility hacks to allow usage of more modern Qt5/C++11 features in Qt4 builds.
*/
#define QStringLiteral(str) QString::fromUtf8("" str "", sizeof(str) - 1)
#define qCDebug(cat) qDebug()
#define qCWarning(cat) qWarning()
#endif
include(KDEFrameworkCompilerSettings)
add_subdirectory(core)
if(TARGET Qt5::Widgets OR QT_QTGUI_LIBRARIES)
if(TARGET Qt5::Widgets)
add_subdirectory(widgets)
endif()
if(TARGET Qt5::Qml)
......
......@@ -18,13 +18,9 @@ set(userfeedback_core_srcs
startcountsource.cpp
surveyinfo.cpp
usagetimesource.cpp
auditloguicontroller.cpp
${userfeedback_core_QM_LOADER}
)
if(Qt5Core_FOUND)
list(APPEND userfeedback_core_srcs
${userfeedback_core_QM_LOADER}
auditloguicontroller.cpp
)
endif()
add_library(KUserFeedbackCore SHARED ${userfeedback_core_srcs})
set_target_properties(KUserFeedbackCore PROPERTIES
......@@ -33,15 +29,11 @@ set_target_properties(KUserFeedbackCore PROPERTIES
)
generate_export_header(KUserFeedbackCore)
if(Qt5Core_FOUND)
target_link_libraries(KUserFeedbackCore PUBLIC Qt5::Core PRIVATE Qt5::Gui Qt5::Network)
if(ANDROID)
target_link_libraries(KUserFeedbackCore PRIVATE GLESv2)
endif()
target_compile_definitions(KUserFeedbackCore PRIVATE QT_DISABLE_DEPRECATED_BEFORE=0x050300)
else()
target_link_libraries(KUserFeedbackCore PUBLIC ${QT_QTCORE_LIBRARIES} PRIVATE ${QT_QTGUI_LIBRARIES} ${QT_QTNETWORK_LIBRARIES})
target_link_libraries(KUserFeedbackCore PUBLIC Qt5::Core PRIVATE Qt5::Gui Qt5::Network)
if(ANDROID)
target_link_libraries(KUserFeedbackCore PRIVATE GLESv2)
endif()
target_compile_definitions(KUserFeedbackCore PRIVATE QT_DISABLE_DEPRECATED_BEFORE=0x050300)
target_link_libraries(KUserFeedbackCore PRIVATE KUserFeedbackCommon)
target_include_directories(KUserFeedbackCore PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_BINARY_DIR}>")
target_include_directories(KUserFeedbackCore INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR}/KUserFeedback;${KDE_INSTALL_INCLUDEDIR}>")
......
......@@ -47,9 +47,7 @@ public:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role) const override;
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QHash<int, QByteArray> roleNames() const override;
#endif
private:
QString m_path;
......@@ -110,7 +108,6 @@ QVariant AuditLogEntryModel::data(const QModelIndex &index, int role) const
return QVariant();
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QHash<int, QByteArray> AuditLogEntryModel::roleNames() const
{
QHash<int, QByteArray> roles;
......@@ -118,7 +115,6 @@ QHash<int, QByteArray> AuditLogEntryModel::roleNames() const
roles.insert(Qt::UserRole, "data");
return roles;
}
#endif
AuditLogUiController::AuditLogUiController(QObject* parent)
......
......@@ -36,11 +36,7 @@ QString CpuInfoSource::description() const
QVariant CpuInfoSource::data()
{
QVariantMap m;
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
m.insert(QStringLiteral("architecture"), QSysInfo::currentCpuArchitecture());
#else
m.insert(QStringLiteral("architecture"), QStringLiteral("unknown"));
#endif
m.insert(QStringLiteral("count"), QThread::idealThreadCount());
return m;
}
......@@ -18,9 +18,7 @@
#include "feedbackconfiguicontroller.h"
#include "abstractdatasource.h"
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QGuiApplication>
#endif
#include <QSet>
#include <QVector>
......@@ -48,11 +46,7 @@ FeedbackConfigUiControllerPrivate::FeedbackConfigUiControllerPrivate() :
QString FeedbackConfigUiControllerPrivate::appName()
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
return QGuiApplication::applicationDisplayName();
#else
return QString();
#endif
}
FeedbackConfigUiController::FeedbackConfigUiController(QObject* parent)
......
......@@ -20,12 +20,10 @@
#include <qglobal.h>
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
#include <QLoggingCategory>
namespace KUserFeedback {
Q_DECLARE_LOGGING_CATEGORY(Log)
}
#endif
#endif
......@@ -19,12 +19,10 @@
#include "openglinfosource_p.h"
#include <QVariant>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QOpenGLContext>
#include <QOpenGLFunctions>
#include <QSurfaceFormat>
#include <QWindow>
#endif
using namespace KUserFeedback;
......@@ -42,7 +40,6 @@ QVariant OpenGLInfoSource::data()
{
QVariantMap m;
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QOpenGLContext context;
if (context.create()) {
QWindow window;
......@@ -93,7 +90,6 @@ QVariant OpenGLInfoSource::data()
return m;
}
#endif
m.insert(QStringLiteral("type"), QStringLiteral("none"));
return m;
......
......@@ -35,7 +35,6 @@ QString PlatformInfoSource::description() const
QVariant PlatformInfoSource::data()
{
QVariantMap m;
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
#if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
// on Linux productType() is the distro name
m.insert(QStringLiteral("os"), QStringLiteral("linux"));
......@@ -61,44 +60,6 @@ QVariant PlatformInfoSource::data()
#else
m.insert(QStringLiteral("os"), QSysInfo::productType());
m.insert(QStringLiteral("version"), QSysInfo::productVersion());
#endif
#else
// Qt4 and Qt5 < 5.4
#ifdef Q_OS_LINUX
m.insert(QStringLiteral("os"), QStringLiteral("linux"));
m.insert(QStringLiteral("version"), QStringLiteral("unknown")); // TODO could be done by reading /etc/os-release
#elif defined(Q_OS_WIN32)
m.insert(QStringLiteral("os"), QStringLiteral("windows"));
switch (QSysInfo::windowsVersion()) {
case QSysInfo::WV_NT: m.insert(QStringLiteral("version"), QStringLiteral("4.0")); break;
case QSysInfo::WV_2000: m.insert(QStringLiteral("version"), QStringLiteral("5.0")); break;
case QSysInfo::WV_XP: m.insert(QStringLiteral("version"), QStringLiteral("5.1")); break;
case QSysInfo::WV_2003: m.insert(QStringLiteral("version"), QStringLiteral("5.2")); break;
case QSysInfo::WV_VISTA: m.insert(QStringLiteral("version"), QStringLiteral("6.0")); break;
case QSysInfo::WV_WINDOWS7: m.insert(QStringLiteral("version"), QStringLiteral("6.1")); break;
case QSysInfo::WV_WINDOWS8: m.insert(QStringLiteral("version"), QStringLiteral("6.2")); break;
#if QT_VERSION > QT_VERSION_CHECK(4, 8, 5)
case QSysInfo::WV_WINDOWS8_1: m.insert(QStringLiteral("version"), QStringLiteral("6.3")); break;
#endif
default: m.insert(QStringLiteral("version"), QStringLiteral("unknown"));
}
#elif defined(Q_OS_MAC)
m.insert(QStringLiteral("os"), QStringLiteral("macos"));
switch (QSysInfo::MacintoshVersion) {
case QSysInfo::MV_10_3: m.insert(QStringLiteral("version"), QStringLiteral("10.3")); break;
case QSysInfo::MV_10_4: m.insert(QStringLiteral("version"), QStringLiteral("10.4")); break;
case QSysInfo::MV_10_5: m.insert(QStringLiteral("version"), QStringLiteral("10.5")); break;
case QSysInfo::MV_10_6: m.insert(QStringLiteral("version"), QStringLiteral("10.6")); break;
case QSysInfo::MV_10_7: m.insert(QStringLiteral("version"), QStringLiteral("10.7")); break;
case QSysInfo::MV_10_8: m.insert(QStringLiteral("version"), QStringLiteral("10.8")); break;
case QSysInfo::MV_10_9: m.insert(QStringLiteral("version"), QStringLiteral("10.9")); break;
default: m.insert(QStringLiteral("version"), QStringLiteral("unknown"));
}
#else
m.insert(QStringLiteral("os"), QStringLiteral("unusual"));
#endif