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

Make it compile against qt6

parent 8d477356
Pipeline #125089 passed with stage
in 1 minute and 29 seconds
......@@ -14,7 +14,7 @@ set(GRANATIER_VERSION "${GRANATIER_BASE_VERSION}.${RELEASE_SERVICE_COMPACT_VERSI
project(granatier VERSION ${GRANATIER_VERSION})
set (QT_MIN_VERSION "5.15.0")
set (KF5_MIN_VERSION "5.89.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} )
......@@ -29,7 +29,7 @@ include(ECMAddAppIcon)
include(ECMQtDeclareLoggingCategory)
include(ECMSetupVersion)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Widgets Svg)
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Widgets Svg)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
CoreAddons
Config
......
......@@ -85,10 +85,10 @@ file(GLOB ICONS_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/../icons/*-apps-granatier.png"
ecm_add_app_icon(granatier ICONS ${ICONS_SRCS})
target_link_libraries(granatier
Qt::Xml
Qt::Widgets
Qt${QT_MAJOR_VERSION}::Xml
Qt${QT_MAJOR_VERSION}::Widgets
KF5KDEGames
Qt::Svg
Qt${QT_MAJOR_VERSION}::Svg
KF5::DBusAddons
KF5::Crash
KF5::XmlGui
......
......@@ -83,7 +83,7 @@ void Arena::addPlayerPosition(const QPointF &p_position)
int nShuffle;
for (int i = 0; i < m_playerPosition.size(); i++)
{
nShuffle = granatier::RNG::fromRange(0, m_playerPosition.size()-1);
nShuffle = granatier::RNG::fromRange<int>(0, m_playerPosition.size()-1);
m_playerPosition.swapItemsAt(i, nShuffle);
}
}
......
......@@ -10,8 +10,7 @@
#include <QKeySequence>
#include <QString>
#include <QMap>
class QStringList;
#include <QStringList>
class PlayerSettings
{
......
......@@ -113,7 +113,7 @@ void Game::init()
}
}
int nIndex = granatier::RNG::fromRange(0, m_randomArenaModeArenaList.count() - 1);
int nIndex = granatier::RNG::fromRange<int>(0, m_randomArenaModeArenaList.count() - 1);
filePath = m_randomArenaModeArenaList.at(nIndex);
m_randomArenaModeArenaList.removeAt(nIndex);
}
......
......@@ -60,14 +60,20 @@ bool MapParser::parse(QIODevice *input)
return true;
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
bool MapParser::characters(const QStringRef &ch)
#else
bool MapParser::characters(const QStringView &ch)
#endif
{
m_buffer = ch.toString();
return true;
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
bool MapParser::startElement(const QStringRef &namespaceURI, const QStringRef &localName, const QStringRef &qName, const QXmlStreamAttributes &atts)
#else
bool MapParser::startElement(const QStringView &namespaceURI, const QStringView &localName, const QStringView &qName, const QXmlStreamAttributes &atts)
#endif
{
Q_UNUSED(namespaceURI)
Q_UNUSED(localName)
......@@ -86,8 +92,11 @@ bool MapParser::startElement(const QStringRef &namespaceURI, const QStringRef &l
return true;
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
bool MapParser::endElement(const QStringRef &namespaceURI, const QStringRef &localName, const QStringRef &qName)
#else
bool MapParser::endElement(const QStringView &namespaceURI, const QStringView &localName, const QStringView &qName)
#endif
{
Q_UNUSED(namespaceURI)
Q_UNUSED(localName)
......
......@@ -39,7 +39,7 @@ public:
* Deletes the GameParser instance.
*/
~MapParser();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
Q_REQUIRED_RESULT bool characters(const QStringRef &ch);
Q_REQUIRED_RESULT bool startElement(const QStringRef &namespaceURI, const QStringRef &localName,
......@@ -47,7 +47,15 @@ public:
Q_REQUIRED_RESULT bool endElement(const QStringRef &namespaceURI,
const QStringRef &localName, const QStringRef &qName);
#else
Q_REQUIRED_RESULT bool characters(const QStringView &ch);
Q_REQUIRED_RESULT bool startElement(const QStringView &namespaceURI, const QStringView &localName,
const QStringView &qName, const QXmlStreamAttributes &atts);
Q_REQUIRED_RESULT bool endElement(const QStringView &namespaceURI,
const QStringView &localName, const QStringView &qName);
#endif
Q_REQUIRED_RESULT bool parse(QIODevice *input);
};
......
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