Use QByteArrayLiteral for such literals

This commit is contained in:
Martchus 2023-03-28 17:20:59 +02:00
parent 55360b2563
commit db657bb1aa
5 changed files with 6 additions and 6 deletions

View File

@ -40,7 +40,7 @@ QNetworkRequest SyncthingConnection::prepareRequest(const QString &path, const Q
url.setPassword(password()); url.setPassword(password());
url.setQuery(query); url.setQuery(query);
QNetworkRequest request(url); QNetworkRequest request(url);
request.setHeader(QNetworkRequest::ContentTypeHeader, QByteArray("application/x-www-form-urlencoded")); request.setHeader(QNetworkRequest::ContentTypeHeader, QByteArrayLiteral("application/x-www-form-urlencoded"));
request.setRawHeader("X-API-Key", m_apiKey); request.setRawHeader("X-API-Key", m_apiKey);
return request; return request;
} }
@ -221,7 +221,7 @@ QString SyncthingConnection::configPath() const
*/ */
QByteArray SyncthingConnection::changeConfigVerb() const QByteArray SyncthingConnection::changeConfigVerb() const
{ {
return isUsingDeprecatedRoutes() ? QByteArray("POST") : QByteArray("PUT"); return isUsingDeprecatedRoutes() ? QByteArrayLiteral("POST") : QByteArrayLiteral("PUT");
} }
/*! /*!

View File

@ -325,7 +325,7 @@ void ConnectionTests::testErrorCases()
})); }));
// setup/define test for error handling // setup/define test for error handling
m_connection.setApiKey(QByteArray("wrong API key")); m_connection.setApiKey(QByteArrayLiteral("wrong API key"));
bool syncthingAvailable = false; bool syncthingAvailable = false;
constexpr auto syncthingCheckInterval = TimeSpan::fromMilliseconds(200.0); constexpr auto syncthingCheckInterval = TimeSpan::fromMilliseconds(200.0);
const auto maxSyncthingStartupTime = TimeSpan::fromSeconds(15.0 * max(timeoutFactor, 5.0)); const auto maxSyncthingStartupTime = TimeSpan::fromSeconds(15.0 * max(timeoutFactor, 5.0));

View File

@ -172,7 +172,7 @@ void MiscTests::testConnectionSettingsAndLoadingSelfSignedCert()
{ {
SyncthingConnectionSettings settings; SyncthingConnectionSettings settings;
settings.syncthingUrl = QStringLiteral("http://localhost:8080"); settings.syncthingUrl = QStringLiteral("http://localhost:8080");
settings.apiKey = QByteArray("foo"); settings.apiKey = QByteArrayLiteral("foo");
settings.httpsCertPath = SyncthingConfig::locateHttpsCertificate(); settings.httpsCertPath = SyncthingConfig::locateHttpsCertificate();
if (!settings.httpsCertPath.isEmpty() && settings.loadHttpsCert()) { if (!settings.httpsCertPath.isEmpty() && settings.loadHttpsCert()) {
CPPUNIT_ASSERT_GREATER(static_cast<decltype(settings.expectedSslErrors.size())>(0), settings.expectedSslErrors.size()); CPPUNIT_ASSERT_GREATER(static_cast<decltype(settings.expectedSslErrors.size())>(0), settings.expectedSslErrors.size());

View File

@ -280,7 +280,7 @@ void SyncthingLauncher::stopLibSyncthing()
#else #else
void SyncthingLauncher::showLibSyncthingNotSupported() void SyncthingLauncher::showLibSyncthingNotSupported()
{ {
handleOutputAvailable(QByteArray("libsyncthing support not enabled")); handleOutputAvailable(QByteArrayLiteral("libsyncthing support not enabled"));
emit exited(-1, QProcess::CrashExit); emit exited(-1, QProcess::CrashExit);
} }
#endif #endif

View File

@ -10,7 +10,7 @@ namespace QtGui {
void WebViewInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info) void WebViewInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
{ {
info.setHttpHeader(QByteArray("X-API-Key"), m_settings.apiKey); info.setHttpHeader(QByteArrayLiteral("X-API-Key"), m_settings.apiKey);
} }
} // namespace QtGui } // namespace QtGui