Commit 5e0c7685 authored by Laurent Montel's avatar Laurent Montel 😁

Minor qstring optimization

parent b233b24b
......@@ -299,7 +299,7 @@ MusicAudioTrack AbstractFileListing::scanOneFile(const QUrl &scanFile, const QFi
auto localFileName = scanFile.toLocalFile();
const auto &fileMimeType = d->mMimeDb.mimeTypeForFile(localFileName);
if (!fileMimeType.name().startsWith(QStringLiteral("audio/"))) {
if (!fileMimeType.name().startsWith(QLatin1String("audio/"))) {
return newTrack;
}
......
......@@ -127,19 +127,19 @@ void AndroidMusicListener::newMusicTrack(const QString &trackDescription)
auto newTrack = MusicAudioTrack{};
newTrack.setTitle(trackData[1]);
bool conversionOK = false;
if (trackData[2] != QStringLiteral("null")) {
if (trackData[2] != QLatin1String("null")) {
newTrack.setTrackNumber(trackData[2].toInt(&conversionOK));
if (!conversionOK) {
qInfo() << "newMusicTrack" << trackData[1] << trackData[2];
}
}
if (trackData[3] != QStringLiteral("null")) {
if (trackData[3] != QLatin1String("null")) {
newTrack.setYear(trackData[3].toInt(&conversionOK));
if (!conversionOK) {
qInfo() << "newMusicTrack" << trackData[1] << trackData[3];
}
}
if (trackData[4] != QStringLiteral("null")) {
if (trackData[4] != QLatin1String("null")) {
newTrack.setDuration(QTime::fromMSecsSinceStartOfDay(trackData[4].toInt()));
}
newTrack.setResourceURI(QUrl::fromLocalFile(trackData[5]));
......@@ -162,7 +162,7 @@ void AndroidMusicListener::newMusicAlbum(const QString &albumDescription)
{
auto albumData = albumDescription.split(QStringLiteral("||"));
if (albumData[2] != QStringLiteral("null)")) {
if (albumData[2] != QLatin1String("null)")) {
d->mCovers[albumData[1]] = QUrl::fromLocalFile(albumData[2]);
}
}
......
......@@ -135,7 +135,7 @@ void LocalBalooFileListing::newBalooFile(const QString &fileName)
}
const auto &fileMimeType = mimeDatabase().mimeTypeForFile(fileName);
if (!fileMimeType.name().startsWith(QStringLiteral("audio/"))) {
if (!fileMimeType.name().startsWith(QLatin1String("audio/"))) {
return;
}
......@@ -275,7 +275,7 @@ void LocalBalooFileListing::serviceOwnerChanged(const QString &serviceName, cons
qCDebug(orgKdeElisaBaloo) << "LocalBalooFileListing::serviceOwnerChanged" << serviceName << oldOwner << newOwner;
if (serviceName == QStringLiteral("org.kde.baloo") && !newOwner.isEmpty()) {
if (serviceName == QLatin1String("org.kde.baloo") && !newOwner.isEmpty()) {
d->mIsRegisteredToBaloo = false;
d->mIsRegisteredToBalooWatcher = false;
registerToBaloo();
......@@ -286,7 +286,7 @@ void LocalBalooFileListing::serviceRegistered(const QString &serviceName)
{
qCDebug(orgKdeElisaBaloo) << "LocalBalooFileListing::serviceRegistered" << serviceName;
if (serviceName == QStringLiteral("org.kde.baloo")) {
if (serviceName == QLatin1String("org.kde.baloo")) {
registerToBaloo();
}
}
......@@ -295,7 +295,7 @@ void LocalBalooFileListing::serviceUnregistered(const QString &serviceName)
{
qCDebug(orgKdeElisaBaloo) << "LocalBalooFileListing::serviceUnregistered" << serviceName;
if (serviceName == QStringLiteral("org.kde.baloo")) {
if (serviceName == QLatin1String("org.kde.baloo")) {
d->mIsRegisteredToBaloo = false;
d->mIsRegisteredToBalooWatcher = false;
}
......
......@@ -1158,13 +1158,13 @@ void DatabaseInterface::initDatabase()
{
auto listTables = d->mTracksDatabase.tables();
if (listTables.contains(QStringLiteral("DatabaseVersionV2")) ||
listTables.contains(QStringLiteral("DatabaseVersionV3")) ||
listTables.contains(QStringLiteral("DatabaseVersionV4")) ||
listTables.contains(QStringLiteral("DatabaseVersionV6")) ||
listTables.contains(QStringLiteral("DatabaseVersionV7")) ||
listTables.contains(QStringLiteral("DatabaseVersionV8")) ||
listTables.contains(QStringLiteral("DatabaseVersionV10"))) {
if (listTables.contains(QLatin1String("DatabaseVersionV2")) ||
listTables.contains(QLatin1String("DatabaseVersionV3")) ||
listTables.contains(QLatin1String("DatabaseVersionV4")) ||
listTables.contains(QLatin1String("DatabaseVersionV6")) ||
listTables.contains(QLatin1String("DatabaseVersionV7")) ||
listTables.contains(QLatin1String("DatabaseVersionV8")) ||
listTables.contains(QLatin1String("DatabaseVersionV10"))) {
qCDebug(orgKdeElisaDatabase()) << "Old database schema unsupported: delete and start from scratch";
qCDebug(orgKdeElisaDatabase()) << "list of old tables" << d->mTracksDatabase.tables();
......@@ -1195,7 +1195,7 @@ void DatabaseInterface::initDatabase()
QSqlQuery createSchemaQuery(d->mTracksDatabase);
auto result = createSchemaQuery.exec(QStringLiteral("DROP TABLE ") + oneTable);
auto result = createSchemaQuery.exec(QLatin1String("DROP TABLE ") + oneTable);
if (!result) {
qCDebug(orgKdeElisaDatabase) << "DatabaseInterface::initDatabase" << createSchemaQuery.lastQuery();
......@@ -1210,8 +1210,8 @@ void DatabaseInterface::initDatabase()
listTables = d->mTracksDatabase.tables();
if (listTables.contains(QStringLiteral("DatabaseVersionV5")) &&
!listTables.contains(QStringLiteral("DatabaseVersionV9"))) {
if (listTables.contains(QLatin1String("DatabaseVersionV5")) &&
!listTables.contains(QLatin1String("DatabaseVersionV9"))) {
upgradeDatabaseV9();
upgradeDatabaseV11();
upgradeDatabaseV12();
......@@ -1219,17 +1219,17 @@ void DatabaseInterface::initDatabase()
upgradeDatabaseV14();
checkDatabaseSchema();
} else if (listTables.contains(QStringLiteral("DatabaseVersionV9"))) {
if (!listTables.contains(QStringLiteral("DatabaseVersionV11"))) {
} else if (listTables.contains(QLatin1String("DatabaseVersionV9"))) {
if (!listTables.contains(QLatin1String("DatabaseVersionV11"))) {
upgradeDatabaseV11();
}
if (!listTables.contains(QStringLiteral("DatabaseVersionV12"))) {
if (!listTables.contains(QLatin1String("DatabaseVersionV12"))) {
upgradeDatabaseV12();
}
if (!listTables.contains(QStringLiteral("DatabaseVersionV13"))) {
if (!listTables.contains(QLatin1String("DatabaseVersionV13"))) {
upgradeDatabaseV13();
}
if (!listTables.contains(QStringLiteral("DatabaseVersionV14"))) {
if (!listTables.contains(QLatin1String("DatabaseVersionV14"))) {
upgradeDatabaseV14();
}
......@@ -6363,7 +6363,7 @@ DatabaseInterface::TrackDataType DatabaseInterface::buildTrackDataFromDatabaseRe
if (!trackRecord.value(14).toString().isEmpty()) {
result[TrackDataType::key_type::ImageUrlRole] = QUrl(trackRecord.value(14).toString());
} else if (!trackRecord.value(30).toString().isEmpty()) {
result[TrackDataType::key_type::ImageUrlRole] = QVariant{QStringLiteral("image://cover/") + trackRecord.value(30).toUrl().toLocalFile()};
result[TrackDataType::key_type::ImageUrlRole] = QVariant{QLatin1String("image://cover/") + trackRecord.value(30).toUrl().toLocalFile()};
}
result[TrackDataType::key_type::IsSingleDiscAlbumRole] = trackRecord.value(15);
if (!trackRecord.value(16).isNull()) {
......@@ -7351,7 +7351,7 @@ DatabaseInterface::ListAlbumDataType DatabaseInterface::internalAllAlbumsPartial
if (!currentRecord.value(3).toString().isEmpty()) {
newData[DataType::key_type::ImageUrlRole] = currentRecord.value(3);
} else if (!currentRecord.value(10).toString().isEmpty()) {
newData[DataType::key_type::ImageUrlRole] = QVariant{QStringLiteral("image://cover/") + currentRecord.value(10).toUrl().toLocalFile()};
newData[DataType::key_type::ImageUrlRole] = QVariant{QLatin1String("image://cover/") + currentRecord.value(10).toUrl().toLocalFile()};
}
auto allArtists = currentRecord.value(6).toString().split(QStringLiteral(", "));
allArtists.removeDuplicates();
......@@ -7399,7 +7399,7 @@ DatabaseInterface::AlbumDataType DatabaseInterface::internalOneAlbumPartialData(
if (!currentRecord.value(4).toString().isEmpty()) {
result[DataType::key_type::ImageUrlRole] = currentRecord.value(4);
} else if (!currentRecord.value(11).toString().isEmpty()) {
result[DataType::key_type::ImageUrlRole] = QVariant{QStringLiteral("image://cover/") + currentRecord.value(11).toUrl().toLocalFile()};
result[DataType::key_type::ImageUrlRole] = QVariant{QLatin1String("image://cover/") + currentRecord.value(11).toUrl().toLocalFile()};
}
auto allArtists = currentRecord.value(8).toString().split(QStringLiteral(", "));
......
......@@ -109,63 +109,63 @@ ElisaApplication::~ElisaApplication()
void ElisaApplication::setupActions(const QString &actionName)
{
#if defined KF5XmlGui_FOUND && KF5XmlGui_FOUND
if (actionName == QStringLiteral("file_quit")) {
if (actionName == QLatin1String("file_quit")) {
auto quitAction = KStandardAction::quit(QCoreApplication::instance(), &QCoreApplication::quit, &d->mCollection);
d->mCollection.addAction(actionName, quitAction);
}
if (actionName == QStringLiteral("help_contents") && KAuthorized::authorizeAction(actionName)) {
if (actionName == QLatin1String("help_contents") && KAuthorized::authorizeAction(actionName)) {
auto handBookAction = KStandardAction::helpContents(this, &ElisaApplication::appHelpActivated, &d->mCollection);
d->mCollection.addAction(handBookAction->objectName(), handBookAction);
}
if (actionName == QStringLiteral("help_report_bug") && KAuthorized::authorizeAction(actionName) && !KAboutData::applicationData().bugAddress().isEmpty()) {
if (actionName == QLatin1String("help_report_bug") && KAuthorized::authorizeAction(actionName) && !KAboutData::applicationData().bugAddress().isEmpty()) {
auto reportBugAction = KStandardAction::reportBug(this, &ElisaApplication::reportBug, &d->mCollection);
d->mCollection.addAction(reportBugAction->objectName(), reportBugAction);
}
if (actionName == QStringLiteral("help_about_app") && KAuthorized::authorizeAction(actionName)) {
if (actionName == QLatin1String("help_about_app") && KAuthorized::authorizeAction(actionName)) {
auto aboutAppAction = KStandardAction::aboutApp(this, &ElisaApplication::aboutApplication, this);
d->mCollection.addAction(aboutAppAction->objectName(), aboutAppAction);
}
if (actionName == QStringLiteral("options_configure") && KAuthorized::authorizeAction(actionName)) {
if (actionName == QLatin1String("options_configure") && KAuthorized::authorizeAction(actionName)) {
auto preferencesAction = KStandardAction::preferences(this, &ElisaApplication::configureElisa, this);
d->mCollection.addAction(preferencesAction->objectName(), preferencesAction);
}
if (actionName == QStringLiteral("options_configure_keybinding") && KAuthorized::authorizeAction(actionName)) {
if (actionName == QLatin1String("options_configure_keybinding") && KAuthorized::authorizeAction(actionName)) {
auto keyBindingsAction = KStandardAction::keyBindings(this, &ElisaApplication::configureShortcuts, this);
d->mCollection.addAction(keyBindingsAction->objectName(), keyBindingsAction);
}
if (actionName == QStringLiteral("go_back") && KAuthorized::authorizeAction(actionName)) {
if (actionName == QLatin1String("go_back") && KAuthorized::authorizeAction(actionName)) {
auto goBackAction = KStandardAction::back(this, &ElisaApplication::goBack, this);
d->mCollection.addAction(goBackAction->objectName(), goBackAction);
}
if (actionName == QStringLiteral("toggle_playlist") && KAuthorized::authorizeAction(actionName)) {
if (actionName == QLatin1String("toggle_playlist") && KAuthorized::authorizeAction(actionName)) {
auto togglePlaylistAction = d->mCollection.addAction(actionName, this, &ElisaApplication::togglePlaylist);
togglePlaylistAction->setShortcut(QKeySequence(Qt::Key_F9));
togglePlaylistAction->setText(QStringLiteral("Toggle Playlist"));
}
if (actionName == QStringLiteral("Seek") && KAuthorized::authorizeAction(actionName)) {
if (actionName == QLatin1String("Seek") && KAuthorized::authorizeAction(actionName)) {
auto seekAction = d->mCollection.addAction(actionName, this, &ElisaApplication::seek);
d->mCollection.setDefaultShortcut(seekAction, QKeySequence(Qt::SHIFT + Qt::Key_Right));
}
if (actionName == QStringLiteral("Scrub") && KAuthorized::authorizeAction(actionName)) {
if (actionName == QLatin1String("Scrub") && KAuthorized::authorizeAction(actionName)) {
auto scrubAction = d->mCollection.addAction(actionName, this, &ElisaApplication::scrub);
d->mCollection.setDefaultShortcut(scrubAction, QKeySequence(Qt::SHIFT + Qt::Key_Left));
}
if (actionName == QStringLiteral("Play-Pause") && KAuthorized::authorizeAction(actionName)) {
if (actionName == QLatin1String("Play-Pause") && KAuthorized::authorizeAction(actionName)) {
auto playPauseAction = d->mCollection.addAction(actionName, this, &ElisaApplication::playPause);
d->mCollection.setDefaultShortcut(playPauseAction, QKeySequence(Qt::Key_Space));
}
if (actionName == QStringLiteral("edit_find") && KAuthorized::authorizeAction(actionName)) {
if (actionName == QLatin1String("edit_find") && KAuthorized::authorizeAction(actionName)) {
auto findAction = KStandardAction::find(this, &ElisaApplication::find, this);
d->mCollection.addAction(findAction->objectName(), findAction);
}
......@@ -294,7 +294,7 @@ ElisaUtils::EntryDataList ElisaApplication::checkFileListAndMakeAbsolute(const E
auto newFile = QFileInfo(std::get<1>(oneFile));
if (newFile.isRelative()) {
newFile = QFileInfo(workingDirectory + QStringLiteral("/") + std::get<1>(oneFile));
newFile = QFileInfo(workingDirectory + QLatin1String("/") + std::get<1>(oneFile));
}
if (newFile.exists()) {
......
......@@ -81,7 +81,7 @@ MusicAudioTrack FileScanner::scanOneFile(const QUrl &scanFile, const QMimeDataba
newTrack.setResourceURI(scanFile);
const auto &fileMimeType = mimeDatabase.mimeTypeForFile(localFileName);
if (!fileMimeType.name().startsWith(QStringLiteral("audio/"))) {
if (!fileMimeType.name().startsWith(QLatin1String("audio/"))) {
return newTrack;
}
......@@ -242,7 +242,7 @@ QUrl FileScanner::searchForCoverFile(const QString &localFileName)
trackFileDir.setNameFilters(d->constSearchStrings);
QFileInfoList coverFiles = trackFileDir.entryInfoList();
if (coverFiles.isEmpty()) {
QString dirNamePattern = QStringLiteral("*") + trackFileDir.dirName() + QStringLiteral("*");
QString dirNamePattern = QLatin1String("*") + trackFileDir.dirName() + QLatin1String("*");
QString dirNameNoSpaces = dirNamePattern.remove(QLatin1Char(' '));
QStringList filters = {
dirNamePattern + QStringLiteral(".jpg"),
......
......@@ -89,9 +89,9 @@ void KCMElisaLocalFile::setRootPath(QStringList rootPath)
mRootPath.clear();
for (const auto &onePath : rootPath) {
if (onePath.startsWith(QStringLiteral("file:///"))) {
if (onePath.startsWith(QLatin1String("file:///"))) {
mRootPath.push_back(onePath.mid(7));
} else if (onePath.startsWith(QStringLiteral("file:/"))) {
} else if (onePath.startsWith(QLatin1String("file:/"))) {
mRootPath.push_back(onePath.mid(5));
} else {
mRootPath.push_back(onePath);
......
......@@ -381,7 +381,7 @@ int MediaPlayer2Player::currentTrack() const
void MediaPlayer2Player::setCurrentTrack(int newTrackPosition)
{
m_currentTrack = m_manageAudioPlayer->playerSource().toString();
m_currentTrackId = QDBusObjectPath(QStringLiteral("/org/kde/elisa/playlist/") + QString::number(newTrackPosition)).path();
m_currentTrackId = QDBusObjectPath(QLatin1String("/org/kde/elisa/playlist/") + QString::number(newTrackPosition)).path();
emit currentTrackChanged();
}
......
......@@ -52,9 +52,9 @@ void Mpris2::initDBusService()
// following:
if (!success) {
#if defined Q_OS_WIN
success = QDBusConnection::sessionBus().registerService(mspris2Name + QStringLiteral(".instance") + QString::number(GetCurrentProcessId()));
success = QDBusConnection::sessionBus().registerService(mspris2Name + QLatin1String(".instance") + QString::number(GetCurrentProcessId()));
#else
success = QDBusConnection::sessionBus().registerService(mspris2Name + QStringLiteral(".instance") + QString::number(getpid()));
success = QDBusConnection::sessionBus().registerService(mspris2Name + QLatin1String(".instance") + QString::number(getpid()));
#endif
}
......
......@@ -383,11 +383,11 @@ void DidlParser::decodeContainerNode(const QDomNode &containerNode, QHash<QStrin
#if 0
const QDomNode &classNode = containerNode.firstChildElement(QStringLiteral("upnp:class"));
if (classNode.toElement().text().startsWith(QStringLiteral("object.container.album.musicAlbum"))) {
if (classNode.toElement().text().startsWith(QLatin1String("object.container.album.musicAlbum"))) {
chilData[ColumnsRoles::ItemClassRole] = DidlParser::Album;
} else if (classNode.toElement().text().startsWith(QStringLiteral("object.container.person.musicArtist"))) {
} else if (classNode.toElement().text().startsWith(QLatin1String("object.container.person.musicArtist"))) {
chilData[ColumnsRoles::ItemClassRole] = DidlParser::Artist;
} else if (classNode.toElement().text().startsWith(QStringLiteral("object.container"))) {
} else if (classNode.toElement().text().startsWith(QLatin1String("object.container"))) {
chilData[ColumnsRoles::ItemClassRole] = DidlParser::Container;
}
#endif
......@@ -446,14 +446,14 @@ void DidlParser::decodeAudioTrackNode(const QDomNode &itemNode, QHash<QString, M
const QDomNode &resourceNode = itemNode.firstChildElement(QStringLiteral("res"));
if (!resourceNode.isNull()) {
chilData.setResourceURI(QUrl::fromUserInput(resourceNode.toElement().text()));
if (resourceNode.attributes().contains(QStringLiteral("duration"))) {
if (resourceNode.attributes().contains(QLatin1String("duration"))) {
const QDomNode &durationNode = resourceNode.attributes().namedItem(QStringLiteral("duration"));
QString durationValue = durationNode.nodeValue();
if (durationValue.startsWith(QStringLiteral("0:"))) {
durationValue = durationValue.mid(2);
if (durationValue.startsWith(QLatin1String("0:"))) {
durationValue.remove(0, 2);
}
if (durationValue.contains(uint('.'))) {
durationValue = durationValue.split(QStringLiteral(".")).first();
durationValue = durationValue.split(QLatin1Char('.')).first();
}
chilData.setDuration(QTime::fromString(durationValue, QStringLiteral("mm:ss")));
......@@ -471,7 +471,7 @@ void DidlParser::decodeAudioTrackNode(const QDomNode &itemNode, QHash<QString, M
}
#if 0
if (resourceNode.attributes().contains(QStringLiteral("artist"))) {
if (resourceNode.attributes().contains(QLatin1String("artist"))) {
const QDomNode &artistNode = resourceNode.attributes().namedItem(QStringLiteral("artist"));
//chilData[ColumnsRoles::ArtistRole] = artistNode.nodeValue();
}
......
......@@ -240,7 +240,7 @@ QModelIndex UpnpContentDirectoryModel::parent(const QModelIndex &child) const
auto parentInternalId = d->mUpnpIds[parentStringId];
// special case if we are already at top of model
if (parentStringId == QStringLiteral("0")) {
if (parentStringId == QLatin1Char('0')) {
return createIndex(0, 0, parentInternalId);
}
......@@ -325,7 +325,7 @@ void UpnpContentDirectoryModel::fetchMore(const QModelIndex &parent)
return;
}
if (d->mData[parentInternalId][ColumnsRoles::IdRole].toString() == QStringLiteral("0")) {
if (d->mData[parentInternalId][ColumnsRoles::IdRole].toString() == QLatin1Char('0')) {
d->mContentDirectory->search(d->mData[parentInternalId][ColumnsRoles::IdRole].toString(),
QStringLiteral("upnp:class derivedfrom \"object.container.album\""), d->mFilter, 0, 0, d->mSortCriteria);
} else {
......@@ -497,11 +497,11 @@ void UpnpContentDirectoryModel::browseFinished(const QString &result, int number
}
const QDomNode &classNode = containerNode.firstChildElement(QStringLiteral("upnp:class"));
if (classNode.toElement().text().startsWith(QStringLiteral("object.item.audioItem"))) {
if (classNode.toElement().text().startsWith(QLatin1String("object.item.audioItem"))) {
chilData[ColumnsRoles::ItemClassRole] = UpnpContentDirectoryModel::AudioTrack;
} else if (classNode.toElement().text().startsWith(QStringLiteral("object.container.album"))) {
} else if (classNode.toElement().text().startsWith(QLatin1String("object.container.album"))) {
chilData[ColumnsRoles::ItemClassRole] = UpnpContentDirectoryModel::Album;
} else if (classNode.toElement().text().startsWith(QStringLiteral("object.container"))) {
} else if (classNode.toElement().text().startsWith(QLatin1String("object.container"))) {
chilData[ColumnsRoles::ItemClassRole] = UpnpContentDirectoryModel::Container;
}
......@@ -557,19 +557,19 @@ void UpnpContentDirectoryModel::browseFinished(const QString &result, int number
const QDomNode &resourceNode = itemNode.firstChildElement(QStringLiteral("res"));
if (!resourceNode.isNull()) {
chilData[ColumnsRoles::ResourceRole] = resourceNode.toElement().text();
if (resourceNode.attributes().contains(QStringLiteral("duration"))) {
if (resourceNode.attributes().contains(QLatin1String("duration"))) {
const QDomNode &durationNode = resourceNode.attributes().namedItem(QStringLiteral("duration"));
QString durationValue = durationNode.nodeValue();
if (durationValue.startsWith(QStringLiteral("0:"))) {
durationValue = durationValue.mid(2);
if (durationValue.startsWith(QLatin1String("0:"))) {
durationValue.remove(0, 2);
}
if (durationValue.contains(uint('.'))) {
durationValue = durationValue.split(QStringLiteral(".")).first();
durationValue = durationValue.split(QLatin1Char('.')).first();
}
chilData[ColumnsRoles::DurationRole] = durationValue;
}
if (resourceNode.attributes().contains(QStringLiteral("artist"))) {
if (resourceNode.attributes().contains(QLatin1String("artist"))) {
const QDomNode &artistNode = resourceNode.attributes().namedItem(QStringLiteral("artist"));
chilData[ColumnsRoles::ArtistRole] = artistNode.nodeValue();
}
......@@ -577,11 +577,11 @@ void UpnpContentDirectoryModel::browseFinished(const QString &result, int number
const QDomNode &classNode = itemNode.firstChildElement(QStringLiteral("upnp:class"));
if (!classNode.isNull()) {
if (classNode.toElement().text().startsWith(QStringLiteral("object.item.audioItem"))) {
if (classNode.toElement().text().startsWith(QLatin1String("object.item.audioItem"))) {
chilData[ColumnsRoles::ItemClassRole] = UpnpContentDirectoryModel::AudioTrack;
} else if (classNode.toElement().text().startsWith(QStringLiteral("object.container.album"))) {
} else if (classNode.toElement().text().startsWith(QLatin1String("object.container.album"))) {
chilData[ColumnsRoles::ItemClassRole] = UpnpContentDirectoryModel::Album;
} else if (classNode.toElement().text().startsWith(QStringLiteral("object.container"))) {
} else if (classNode.toElement().text().startsWith(QLatin1String("object.container"))) {
chilData[ColumnsRoles::ItemClassRole] = UpnpContentDirectoryModel::Container;
}
}
......
......@@ -124,10 +124,10 @@ void UpnpControlConnectionManager::finishedGetProtocolInfoCall(KDSoapPendingCall
auto answer = self->returnMessage();
auto allValues = answer.childValues();
for (KDSoapValue oneValue : allValues) {
if (oneValue.name() == QStringLiteral("Source")) {
if (oneValue.name() == QLatin1String("Source")) {
d->mSourceProtocolInfo = oneValue.value().toString();
}
if (oneValue.name() == QStringLiteral("Sink")) {
if (oneValue.name() == QLatin1String("Sink")) {
d->mSinkProtocolInfo = oneValue.value().toString();
}
}
......@@ -182,25 +182,25 @@ void UpnpControlConnectionManager::finishedGetCurrentConnectionInfoCall(KDSoapPe
QString connectionStatus;
for (KDSoapValue oneValue : allValues) {
if (oneValue.name() == QStringLiteral("RcsID")) {
if (oneValue.name() == QLatin1String("RcsID")) {
rcsID = oneValue.value().toInt();
}
if (oneValue.name() == QStringLiteral("AVTransportID")) {
if (oneValue.name() == QLatin1String("AVTransportID")) {
avTransportID = oneValue.value().toInt();
}
if (oneValue.name() == QStringLiteral("protocolInfo")) {
if (oneValue.name() == QLatin1String("protocolInfo")) {
protocolInfo = oneValue.value().toInt();
}
if (oneValue.name() == QStringLiteral("PeerConnectionManager")) {
if (oneValue.name() == QLatin1String("PeerConnectionManager")) {
connectionManager = oneValue.value().toInt();
}
if (oneValue.name() == QStringLiteral("PeerConnectionID")) {
if (oneValue.name() == QLatin1String("PeerConnectionID")) {
peerConnectionID = oneValue.value().toInt();
}
if (oneValue.name() == QStringLiteral("Direction")) {
if (oneValue.name() == QLatin1String("Direction")) {
direction = oneValue.value().toInt();
}
if (oneValue.name() == QStringLiteral("Status")) {
if (oneValue.name() == QLatin1String("Status")) {
connectionStatus = oneValue.value().toInt();
}
}
......@@ -224,24 +224,24 @@ void UpnpControlConnectionManager::parseServiceDescription(QIODevice *serviceDes
const QList<QString> &allActions(actions());
d->mHasPrepareForConnection = allActions.contains(QStringLiteral("PrepareForConnection"));
d->mHasPrepareForConnection = allActions.contains(QLatin1String("PrepareForConnection"));
Q_EMIT hasPrepareForConnectionChanged();
d->mHasConnectionComplete = allActions.contains(QStringLiteral("ConnectionComplete"));
d->mHasConnectionComplete = allActions.contains(QLatin1String("ConnectionComplete"));
Q_EMIT hasConnectionCompleteChanged();
}
void UpnpControlConnectionManager::parseEventNotification(const QString &eventName, const QString &eventValue)
{
if (eventName == QStringLiteral("SourceProtocolInfo")) {
if (eventName == QLatin1String("SourceProtocolInfo")) {
d->mSourceProtocolInfo = eventValue;
Q_EMIT sourceProtocolInfoChanged(d->mSourceProtocolInfo);
}
if (eventName == QStringLiteral("SinkProtocolInfo")) {
if (eventName == QLatin1String("SinkProtocolInfo")) {
d->mSinkProtocolInfo = eventValue;
Q_EMIT sinkProtocolInfoChanged(d->mSinkProtocolInfo);
}
if (eventName == QStringLiteral("CurrentConnectionIDs")) {
if (eventName == QLatin1String("CurrentConnectionIDs")) {
d->mCurrentConnectionIDs = eventValue;
Q_EMIT currentConnectionIDsChanged(d->mCurrentConnectionIDs);
}
......
......@@ -123,7 +123,7 @@ void UpnpControlContentDirectory::finishedGetSearchCapabilitiesCall(KDSoapPendin
QString searchCaps;
for (KDSoapValue oneValue : allValues) {
if (oneValue.name() == QStringLiteral("SearchCaps")) {
if (oneValue.name() == QLatin1String("SearchCaps")) {
searchCaps = oneValue.value().toString();
}
}
......@@ -142,7 +142,7 @@ void UpnpControlContentDirectory::finishedGetSortCapabilitiesCall(KDSoapPendingC
QString sortCaps;
for (KDSoapValue oneValue : allValues) {
if (oneValue.name() == QStringLiteral("SortCaps")) {
if (oneValue.name() == QLatin1String("SortCaps")) {
sortCaps = oneValue.value().toString();
}
}
......@@ -160,7 +160,7 @@ void UpnpControlContentDirectory::finishedGetSystemUpdateIDCall(KDSoapPendingCal
auto allValues = answer.childValues();
for (KDSoapValue oneValue : allValues) {
if (oneValue.name() == QStringLiteral("Id")) {
if (oneValue.name() == QLatin1String("Id")) {
d->mSystemUpdateID = oneValue.value().toInt();
}
}
......@@ -182,16 +182,16 @@ void UpnpControlContentDirectory::finishedSearchCall(KDSoapPendingCallWatcher *s
int totalMatches = 0;
for (KDSoapValue oneValue : allValues) {
if (oneValue.name() == QStringLiteral("Result")) {
if (oneValue.name() == QLatin1String("Result")) {
result = oneValue.value().toString();
}
if (oneValue.name() == QStringLiteral("NumberReturned")) {
if (oneValue.name() == QLatin1String("NumberReturned")) {
numberReturned = oneValue.value().toInt();
}
if (oneValue.name() == QStringLiteral("TotalMatches")) {
if (oneValue.name() == QLatin1String("TotalMatches")) {
totalMatches = oneValue.value().toInt();
}
if (oneValue.name() == QStringLiteral("UpdateID")) {
if (oneValue.name() == QLatin1String("UpdateID")) {
d->mSystemUpdateID = oneValue.value().toInt();
}
}
......@@ -215,16 +215,16 @@ void UpnpControlContentDirectory::finishedBrowseCall(KDSoapPendingCallWatcher *s
int totalMatches = 0;
for (KDSoapValue oneValue : allValues) {
if (oneValue.name() == QStringLiteral("Result")) {
if (oneValue.name() == QLatin1String("Result")) {
result = oneValue.value().toString();
}
if (oneValue.name() == QStringLiteral("NumberReturned")) {
if (oneValue.name() == QLatin1String("NumberReturned")) {
numberReturned = oneValue.value().toInt();
}
if (oneValue.name() == QStringLiteral("TotalMatches")) {
if (oneValue.name() == QLatin1String("TotalMatches")) {
totalMatches = oneValue.value().toInt();
}
if (oneValue.name() == QStringLiteral("UpdateID")) {
if (oneValue.name() == QLatin1String("UpdateID")) {
d->mSystemUpdateID = oneValue.value().toInt();
}
}
......@@ -244,7 +244,7 @@ void UpnpControlContentDirectory::parseServiceDescription(QIODevice *serviceDesc
const QList<QString> &allVariables(stateVariables());
d->mHasTransferIDs = allVariables.contains(QStringLiteral("TransferIDs"));
d->mHasTransferIDs = allVariables.contains(QLatin1String("TransferIDs"));
Q_EMIT hasTransferIDsChanged();
//const QList<QString> &allActions(actions());
......@@ -252,11 +252,11 @@ void UpnpControlContentDirectory::parseServiceDescription(QIODevice *serviceDesc
void UpnpControlContentDirectory::parseEventNotification(const QString &eventName, const QString &eventValue)
{
if (eventName == QStringLiteral("TransferIDs")) {
if (eventName == QLatin1String("TransferIDs")) {
d->mTransferIDs = eventValue;
Q_EMIT transferIDsChanged(d->mTransferIDs);
}
if (eventName == QStringLiteral("SystemUpdateID")) {
if (eventName == QLatin1String("SystemUpdateID")) {
d->mSystemUpdateID = eventValue.toInt();
Q_EMIT systemUpdateIDChanged(d->mSystemUpdateID);
}
......