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

Make it compile against qt6

parent 44008ddb
Pipeline #175786 passed with stage
in 1 minute and 6 seconds
......@@ -13,7 +13,7 @@ set(KMAHJONGG_VERSION "${KMAHJONGG_BASE_VERSION}.${RELEASE_SERVICE_COMPACT_VERSI
project(kmahjongg VERSION ${KMAHJONGG_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 NO_MODULE)
......@@ -33,7 +33,7 @@ include(ECMQtDeclareLoggingCategory)
include(ECMSetupVersion)
include(FeatureSummary)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Gui Svg)
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Gui Svg)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Config
CoreAddons
......
......@@ -107,7 +107,9 @@ bool BoardLayout::loadBoardLayout_10(const QString & from)
if (f.open(QIODevice::ReadOnly)) {
QTextStream t(&f);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
t.setCodec(QTextCodec::codecForName("UTF-8"));
#endif
QString s(t.readLine());
if (s != layoutMagic1_0()) {
......@@ -155,7 +157,9 @@ bool BoardLayout::loadBoardLayout(const QString & from)
QFile f(from);
if (f.open(QIODevice::ReadOnly)) {
QTextStream t(&f);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
t.setCodec(QTextCodec::codecForName("UTF-8"));
#endif
QString s(t.readLine());
if (s != layoutMagic1_1()) {
......@@ -174,15 +178,27 @@ bool BoardLayout::loadBoardLayout(const QString & from)
continue;
}
if (s[0] == QLatin1Char('w')) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
m_width = s.midRef(1).toInt();
#else
m_width = QStringView(s).mid(1).toInt();
#endif
continue;
}
if (s[0] == QLatin1Char('h')) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
m_height = s.midRef(1).toInt();
#else
m_height = QStringView(s).mid(1).toInt();
#endif
continue;
}
if (s[0] == QLatin1Char('d')) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
m_depth = s.midRef(1).toInt();
#else
m_depth = QStringView(s).mid(1).toInt();
#endif
continue;
}
all += s;
......
......@@ -17,6 +17,7 @@
#include <QLabel>
#include <QPainter>
#include <QResizeEvent>
#include <QActionGroup>
// KF
#include <KActionCollection>
......
......@@ -13,8 +13,9 @@
#include <KCrash>
#include <KDBusService>
#include <KLocalizedString>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <Kdelibs4ConfigMigrator>
#endif
// KMahjongg
#include "kmahjongg.h"
#include "kmahjongg_version.h"
......@@ -48,13 +49,13 @@ int main(int argc, char ** argv)
aboutData.setupCommandLine(&parser);
parser.process(app);
aboutData.processCommandLine(&parser);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
// Migrate pre-existing (4.x) configuration
Kdelibs4ConfigMigrator migrate(QStringLiteral("kmahjongg"));
migrate.setConfigFiles(QStringList() << QStringLiteral("kmahjonggrc"));
migrate.setUiFiles(QStringList() << QStringLiteral("kmahjonggui.rc"));
migrate.migrate();
#endif
KDBusService service;
if (app.isSessionRestored()) {
......
Supports Markdown
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