Commit 2eab5028 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix some compile error against qt6

parent 04520799
Pipeline #175789 passed with stage
in 1 minute and 32 seconds
......@@ -177,7 +177,11 @@ static QHostAddress linux_ipv6_to_qaddr(const QString &in)
for(int n = 0; n < 16; ++n)
{
bool ok;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
int x = in.midRef(n * 2, 2).toInt(&ok, 16);
#else
int x = QStringView(in).mid(n * 2, 2).toInt(&ok, 16);
#endif
if(!ok)
return out;
raw[n] = (quint8)x;
......@@ -196,7 +200,11 @@ static QHostAddress linux_ipv4_to_qaddr(const QString &in)
for(int n = 0; n < 4; ++n)
{
bool ok;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
int x = in.midRef(n * 2, 2).toInt(&ok, 16);
#else
int x = QStringView(in).mid(n * 2, 2).toInt(&ok, 16);
#endif
if(!ok)
return out;
rawp[n] = (unsigned char )x;
......
......@@ -65,7 +65,11 @@ static bool extractMainHeader(const QString &line, QString *proto, int *code, QS
if(n2 == -1)
return false;
if(code)
*code = line.midRef(n, n2-n).toInt();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
*code = line.midRef(n, n2-n).toInt();
#else
*code = QStringView(line).mid(n, n2-n).toInt();
#endif
n = n2+1;
if(msg)
*msg = line.mid(n);
......
......@@ -421,7 +421,11 @@ static bool extractMainHeader(const QString &line, QString *proto, int *code, QS
if(n2 == -1)
return false;
if(code)
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
*code = line.midRef(n, n2-n).toInt();
#else
*code = QStringView(line).mid(n, n2-n).toInt();
#endif
n = n2+1;
if(msg)
*msg = line.mid(n);
......
......@@ -443,8 +443,13 @@ void BasicProtocol::handleDocOpen(const Parser::Event &pe)
if(!verstr.isEmpty()) {
int n = verstr.indexOf('.');
if(n != -1) {
major = verstr.midRef(0, n).toInt();
minor = verstr.midRef(n+1).toInt();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
major = verstr.midRef(0, n).toInt();
minor = verstr.midRef(n+1).toInt();
#else
major = QStringView(verstr).mid(0, n).toInt();
minor = QStringView(verstr).mid(n+1).toInt();
#endif
}
else {
major = verstr.toInt();
......
......@@ -87,7 +87,7 @@ QDateTime stamp2TS(const QString &ts)
{
if(ts.length() != 17)
return QDateTime();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
int year = ts.midRef(0,4).toInt();
int month = ts.midRef(4,2).toInt();
int day = ts.midRef(6,2).toInt();
......@@ -95,6 +95,15 @@ QDateTime stamp2TS(const QString &ts)
int hour = ts.midRef(9,2).toInt();
int min = ts.midRef(12,2).toInt();
int sec = ts.midRef(15,2).toInt();
#else
int year = QStringView(ts).mid(0,4).toInt();
int month = QStringView(ts).mid(4,2).toInt();
int day = QStringView(ts).mid(6,2).toInt();
int hour = QStringView(ts).mid(9,2).toInt();
int min = QStringView(ts).mid(12,2).toInt();
int sec = QStringView(ts).mid(15,2).toInt();
#endif
QDate xd;
xd.setDate(year, month, day);
......
......@@ -24,6 +24,7 @@
#include <qdom.h>
#include <QList>
#include <QStringList>
#include "iris_export.h"
......@@ -31,7 +32,6 @@ class QDateTime;
class QRect;
class QSize;
class QColor;
class QStringList;
class IRIS_EXPORT XDomNodeList
{
......
......@@ -22,6 +22,7 @@
#include <QDataStream>
#include <iostream>
#include <QList>
namespace KsirkSkinEditor
{
......
......@@ -38,10 +38,6 @@ This is the standard main function of a KDE application
#include <QCommandLineParser>
#include <QCommandLineOption>
static const char *description =
I18N_NOOP("KsirK Skin Editor");
// INSERT A DESCRIPTION FOR YOUR APPLICATION HERE
int main(int argc, char *argv[])
{
qCDebug(KSIRKSKINEDITOR_LOG) << "Hello World!";
......@@ -53,7 +49,7 @@ int main(int argc, char *argv[])
QStringLiteral("ksirkskineditor"),
i18n("KsirK Skin Editor"),
QStringLiteral(KSIRK_VERSION_STRING),
i18n(description),
i18n("KsirK Skin Editor"),
KAboutLicense::GPL,
i18n("(c) 2008, Gaël de Chalendar\n"),
i18n("For help and user manual, please see\nThe KsirK Web site"),
......
......@@ -999,7 +999,8 @@ void ONU::loadPoolIds(const QString& fileName)
{
qCDebug(KSIRKSKINEDITOR_LOG) << xml.text().toString();
QXmlStreamAttributes attributes = xml.attributes ();
QStringRef id = attributes.value(QLatin1String(""), QStringLiteral("id") );
auto id = attributes.value(QLatin1String(""), QStringLiteral("id") );
if (!id.isEmpty() && !reg.exactMatch(id.toString()))
{
m_poolIds.push_back(id.toString());
......
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