Skip to content

Commit

Permalink
qtsingleapplication: Port to Qt 6
Browse files Browse the repository at this point in the history
* QRegExp -> QRegularExpression
* Use new version of qChecksum
  • Loading branch information
bjorn committed Oct 12, 2020
1 parent 8507fec commit cd09fbc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/qtsingleapplication/src/qtlocalpeer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "qtlocalpeer.h"
#include <QCoreApplication>
#include <QDataStream>
#include <QRegularExpression>
#include <QTime>

#if defined(Q_OS_WIN)
Expand Down Expand Up @@ -78,11 +79,15 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId)
#endif
prefix = id.section(QLatin1Char('/'), -1);
}
prefix.remove(QRegExp(QLatin1String("[^a-zA-Z]")));
prefix.remove(QRegularExpression(QLatin1String("[^a-zA-Z]")));
prefix.truncate(6);

QByteArray idc = id.toUtf8();
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
quint16 idNum = qChecksum(idc.constData(), idc.size());
#else
quint16 idNum = qChecksum(idc);
#endif
socketName = QLatin1String("qtsingleapp-") + prefix
+ QLatin1Char('-') + QString::number(idNum, 16);

Expand Down

0 comments on commit cd09fbc

Please sign in to comment.