Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Games
Granatier
Commits
fd7237fe
Commit
fd7237fe
authored
Jan 18, 2022
by
Laurent Montel
Browse files
Make it compile against qt6
parent
8d477356
Pipeline
#125089
passed with stage
in 1 minute and 29 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
fd7237fe
...
...
@@ -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.
8
9.0"
)
set
(
KF5_MIN_VERSION
"5.9
0
.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
(
Qt
5
${
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
...
...
src/CMakeLists.txt
View file @
fd7237fe
...
...
@@ -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
...
...
src/arena.cpp
View file @
fd7237fe
...
...
@@ -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
);
}
}
...
...
src/config/playersettings.h
View file @
fd7237fe
...
...
@@ -10,8 +10,7 @@
#include
<QKeySequence>
#include
<QString>
#include
<QMap>
class
QStringList
;
#include
<QStringList>
class
PlayerSettings
{
...
...
src/game.cpp
View file @
fd7237fe
...
...
@@ -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
);
}
...
...
src/mapparser.cpp
View file @
fd7237fe
...
...
@@ -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
)
...
...
src/mapparser.h
View file @
fd7237fe
...
...
@@ -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
);
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment