Commit ec7dacb0 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Adapt build system for building against qt6

parent 47f27f82
Pipeline #117685 passed with stage
in 46 seconds
......@@ -9,7 +9,7 @@ set (RELEASE_SERVICE_COMPACT_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}${RELEASE_
project(knavalbattle VERSION "2.1.${RELEASE_SERVICE_COMPACT_VERSION}")
set (QT_MIN_VERSION "5.15.0")
set (KF5_MIN_VERSION "5.85.0")
set (KF5_MIN_VERSION "5.90.0")
find_package(ECM ${KF5_MIN_VERSION} REQUIRED CONFIG)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} )
......@@ -24,7 +24,9 @@ include(ECMSetupVersion)
include(ECMQtDeclareLoggingCategory)
include(FeatureSummary)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Widgets)
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Widgets)
find_package(Qt${QT_MAJOR_VERSION}QuickWidgets ${REQUIRED_QT_VERSION} CONFIG)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Config
Crash
......
......@@ -59,8 +59,8 @@ file(GLOB ICONS_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/../data/pictures/*-apps-knaval
ecm_add_app_icon(knavalbattle ICONS ${ICONS_SRCS})
target_link_libraries(knavalbattle
Qt5::Xml
Qt5::Network
Qt${QT_MAJOR_VERSION}::Xml
Qt${QT_MAJOR_VERSION}::Network
KF5::I18n
KF5::XmlGui
KF5::Completion
......
......@@ -124,8 +124,8 @@ GameOptionsMessage::GameOptionsMessage(const QString& enableAdjacentShips, const
GameOptionsMessage::GameOptionsMessage(const bool enableAdjacentShips, const bool oneOrSeveralShips,
const BattleShipsConfiguration &configuration)
: m_enabledAdjacentShipsString(enableAdjacentShips)
, m_oneOrSeveralShipsString(oneOrSeveralShips)
: m_enabledAdjacentShipsString(enableAdjacentShips ? QStringLiteral("true") : QStringLiteral("false"))
, m_oneOrSeveralShipsString(oneOrSeveralShips ? QStringLiteral("true") : QStringLiteral("false"))
, m_battleShipsConfiguration(new BattleShipsConfiguration(configuration))
{
}
......
......@@ -231,7 +231,11 @@ MessagePtr Protocol::parseMessage(const QString& xmlMessage)
for (int i = 0; i < nodes.count(); i++) {
QDomElement element = nodes.item(i).toElement();
if (!element.isNull() && element.tagName().startsWith(QLatin1String("ship"))) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
int size = element.tagName().midRef(4).toInt();
#else
int size = QStringView(element.tagName()).mid(4).toInt();
#endif
QStringList data = element.text().split(QLatin1Char(' '));
if (data.size() != 3) {
continue;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment