1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor(Qt): use 'QLatin1String' instead of 'QLatin1Literal'

This is an undocumented Qt 2/3/4 remnant, deprecated in Qt 5.14.

- https://code.qt.io/cgit/qt/qtbase.git/commit/?h=5.14&id=3e75c296
- https://code.qt.io/cgit/qt/qtbase.git/commit/?h=5.14&id=45373c19
This commit is contained in:
Jimi Huotari 2019-08-23 14:39:06 +03:00 committed by Anthony Bilinski
parent 731a49854a
commit 7f74d41586
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
5 changed files with 33 additions and 33 deletions

View File

@ -32,7 +32,7 @@ namespace {
QByteArray cleanPath(const char *file)
{
// for privacy, make the path relative to the c-toxcore source directory
const QRegularExpression pathCleaner(QLatin1Literal{"[\\s|\\S]*c-toxcore."});
const QRegularExpression pathCleaner(QLatin1String{"[\\s|\\S]*c-toxcore."});
QByteArray cleanedPath = QString{file}.remove(pathCleaner).toUtf8();
cleanedPath.append('\0');
return cleanedPath;

View File

@ -30,22 +30,22 @@
namespace {
const QUrl NodeListAddress{"https://nodes.tox.chat/json"};
const QLatin1Literal jsonNodeArrayName{"nodes"};
const QLatin1Literal emptyAddress{"-"};
const QLatin1String jsonNodeArrayName{"nodes"};
const QLatin1String emptyAddress{"-"};
const QRegularExpression ToxPkRegEx(QString("(^|\\s)[A-Fa-f0-9]{%1}($|\\s)").arg(64));
const QLatin1Literal builtinNodesFile{":/conf/nodes.json"};
const QLatin1String builtinNodesFile{":/conf/nodes.json"};
} // namespace
namespace NodeFields {
const QLatin1Literal status_udp{"status_udp"};
const QLatin1Literal status_tcp{"status_tcp"};
const QLatin1Literal ipv4{"ipv4"};
const QLatin1Literal ipv6{"ipv6"};
const QLatin1Literal public_key{"public_key"};
const QLatin1Literal port{"port"};
const QLatin1Literal maintainer{"maintainer"};
const QLatin1String status_udp{"status_udp"};
const QLatin1String status_tcp{"status_tcp"};
const QLatin1String ipv4{"ipv4"};
const QLatin1String ipv6{"ipv6"};
const QLatin1String public_key{"public_key"};
const QLatin1String port{"port"};
const QLatin1String maintainer{"maintainer"};
// TODO(sudden6): make use of this field once we differentiate between TCP nodes, and bootstrap nodes
const QLatin1Literal tcp_ports{"tcp_ports"};
const QLatin1String tcp_ports{"tcp_ports"};
const QStringList neededFields{status_udp, status_tcp, ipv4, ipv6, public_key, port, maintainer};
} // namespace NodeFields

View File

@ -29,20 +29,20 @@
#include <QStringList>
namespace {
const QLatin1Literal globalSettingsFile{"qtox.ini"};
const QLatin1Literal profileFolder{"profiles"};
const QLatin1Literal themeFolder{"themes"};
const QLatin1Literal avatarsFolder{"avatars"};
const QLatin1Literal transfersFolder{"transfers"};
const QLatin1Literal screenshotsFolder{"screenshots"};
const QLatin1String globalSettingsFile{"qtox.ini"};
const QLatin1String profileFolder{"profiles"};
const QLatin1String themeFolder{"themes"};
const QLatin1String avatarsFolder{"avatars"};
const QLatin1String transfersFolder{"transfers"};
const QLatin1String screenshotsFolder{"screenshots"};
// NOTE(sudden6): currently unused, but reflects the TCS at 2018-11
#ifdef Q_OS_WIN
const QLatin1Literal TCSToxFileFolder{"%APPDATA%/tox/"};
const QLatin1String TCSToxFileFolder{"%APPDATA%/tox/"};
#elif defined(Q_OS_OSX)
const QLatin1Literal TCSToxFileFolder{"~/Library/Application Support/Tox"};
const QLatin1String TCSToxFileFolder{"~/Library/Application Support/Tox"};
#else
const QLatin1Literal TCSToxFileFolder{"~/.config/tox/"};
const QLatin1String TCSToxFileFolder{"~/.config/tox/"};
#endif
} // namespace

View File

@ -64,9 +64,9 @@
*/
namespace {
const QLatin1Literal ThemeSubFolder{"themes/"};
const QLatin1Literal BuiltinThemeDefaultPath{":themes/default/"};
const QLatin1Literal BuiltinThemeDarkPath{":themes/dark/"};
const QLatin1String ThemeSubFolder{"themes/"};
const QLatin1String BuiltinThemeDefaultPath{":themes/default/"};
const QLatin1String BuiltinThemeDarkPath{":themes/dark/"};
}
// helper functions
@ -273,15 +273,15 @@ const QString Style::resolve(const QString& filename, const QFont& baseFont)
}
for (const QString& key : dictColor.keys()) {
qss.replace(QRegularExpression(key % QLatin1Literal{"\\b"}), dictColor[key]);
qss.replace(QRegularExpression(key % QLatin1String{"\\b"}), dictColor[key]);
}
for (const QString& key : dictFont.keys()) {
qss.replace(QRegularExpression(key % QLatin1Literal{"\\b"}), dictFont[key]);
qss.replace(QRegularExpression(key % QLatin1String{"\\b"}), dictFont[key]);
}
for (const QString& key : dictTheme.keys()) {
qss.replace(QRegularExpression(key % QLatin1Literal{"\\b"}), dictTheme[key]);
qss.replace(QRegularExpression(key % QLatin1String{"\\b"}), dictTheme[key]);
}
// @getImagePath() function

View File

@ -40,12 +40,12 @@ private:
};
namespace {
const QLatin1Literal globalSettingsFile{"qtox.ini"};
const QLatin1Literal profileFolder{"profiles"};
const QLatin1Literal themeFolder{"themes"};
const QLatin1Literal avatarsFolder{"avatars"};
const QLatin1Literal transfersFolder{"transfers"};
const QLatin1Literal screenshotsFolder{"screenshots"};
const QLatin1String globalSettingsFile{"qtox.ini"};
const QLatin1String profileFolder{"profiles"};
const QLatin1String themeFolder{"themes"};
const QLatin1String avatarsFolder{"avatars"};
const QLatin1String transfersFolder{"transfers"};
const QLatin1String screenshotsFolder{"screenshots"};
const QString sep{QDir::separator()};
}