aboutsummaryrefslogtreecommitdiff
path: root/src/demoserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/demoserver.cpp')
-rw-r--r--src/demoserver.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/demoserver.cpp b/src/demoserver.cpp
index feca7c6d..bc7da1c1 100644
--- a/src/demoserver.cpp
+++ b/src/demoserver.cpp
@@ -79,8 +79,11 @@ void DemoServer::recv_data()
{
QString in_data = QString::fromUtf8(client_sock->readAll());
- // Copypasted from NetworkManager
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
+ const QStringList packet_list = in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts));
+#else
const QStringList packet_list = in_data.split("%", Qt::SkipEmptyParts);
+#endif
for (const QString &packet : packet_list) {
QStringList f_contents;
@@ -288,7 +291,9 @@ void DemoServer::load_demo(QString filename)
p_path = filename;
// Process the demo file
QTextStream demo_stream(&demo_file);
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
demo_stream.setCodec("UTF-8");
+#endif
QString line = demo_stream.readLine();
while (!line.isNull()) {
while (!line.endsWith("%")) {
@@ -330,7 +335,9 @@ void DemoServer::load_demo(QString filename)
if (demo_file.open(QIODevice::WriteOnly | QIODevice::Text |
QIODevice::Truncate)) {
QTextStream out(&demo_file);
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec("UTF-8");
+#endif
out << p_demo_data.dequeue();
for (const QString &line : qAsConst(p_demo_data)) {
out << "\n" << line;