mumble/src/QtUtils.cpp
Robert Adam 4e1129b6ed REFAC(client): Put qsslStringConversion to QtUtils
There was a function for processing QsslStrings in UserInformation.cpp
as well as ViewCert.cpp. These functions were completely identical.
Therefore there were name clashes that appeared when performing a unity
build.

Furthermore duplicating functionality in multiple places in never a good
idea. Thus this commit refactors the code so that both classes now use a
shared implementation in QtUtils.cpp.
2021-03-06 18:57:22 +01:00

29 lines
813 B
C++

// Copyright 2016-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
#include <QObject>
#include <QUrl>
#include <QStringList>
namespace Mumble {
namespace QtUtils {
void deleteQObject(QObject *object) { object->deleteLater(); }
QString decode_utf8_qssl_string(const QString &input) {
QString i = input;
return QUrl::fromPercentEncoding(i.replace(QLatin1String("\\x"), QLatin1String("%")).toLatin1());
}
QString decode_first_utf8_qssl_string(const QStringList &list) {
if (list.count() > 0) {
return decode_utf8_qssl_string(list.at(0));
}
return QString();
}
}; // namespace QtUtils
}; // namespace Mumble