Replace QStringLiteral with QLatin1String

This commit is contained in:
Jonas Kvinge
2024-06-12 20:30:36 +02:00
parent 20595a11bc
commit 5451c110b1
64 changed files with 367 additions and 366 deletions

View File

@@ -81,30 +81,30 @@ CollectionFilterWidget::CollectionFilterWidget(QWidget *parent)
available_fields += QLatin1String(", ") + Song::kNumericalSearchColumns.join(QLatin1String(", "));
ui_->search_field->setToolTip(
QStringLiteral("<html><head/><body><p>") +
QLatin1String("<html><head/><body><p>") +
tr("Prefix a word with a field name to limit the search to that field, e.g.:") +
QStringLiteral(" ") +
QStringLiteral("<span style=\"font-weight:600;\">") +
QLatin1Char(' ') +
QLatin1String("<span style=\"font-weight:600;\">") +
tr("artist") +
QStringLiteral(":</span><span style=\"font-style:italic;\">Strawbs</span> ") +
tr("searches the collection for all artists that contain the word %1. ").arg(QStringLiteral("Strawbs")) +
QStringLiteral("</p><p>") +
QLatin1String(":</span><span style=\"font-style:italic;\">Strawbs</span> ") +
tr("searches the collection for all artists that contain the word %1. ").arg(QLatin1String("Strawbs")) +
QLatin1String("</p><p>") +
tr("Search terms for numerical fields can be prefixed with %1 or %2 to refine the search, e.g.: ")
.arg(QStringLiteral(" =, !=, &lt;, &gt;, &lt;="), QStringLiteral("&gt;=")) +
QStringLiteral("<span style=\"font-weight:600;\">") +
.arg(QLatin1String(" =, !=, &lt;, &gt;, &lt;="), QLatin1String("&gt;=")) +
QLatin1String("<span style=\"font-weight:600;\">") +
tr("rating") +
QStringLiteral("</span>") +
QStringLiteral(":>=") +
QStringLiteral("<span style=\"font-weight:italic;\">4</span>") +
QLatin1String("</span>") +
QLatin1String(":>=") +
QLatin1String("<span style=\"font-weight:italic;\">4</span>") +
QStringLiteral("</p><p><span style=\"font-weight:600;\">") +
QLatin1String("</p><p><span style=\"font-weight:600;\">") +
tr("Available fields") +
QStringLiteral(": ") +
QStringLiteral("</span>") +
QStringLiteral("<span style=\"font-style:italic;\">") +
QLatin1String(": ") +
QLatin1String("</span>") +
QLatin1String("<span style=\"font-style:italic;\">") +
available_fields +
QStringLiteral("</span>.") +
QStringLiteral("</p></body></html>")
QLatin1String("</span>.") +
QLatin1String("</p></body></html>")
);
QObject::connect(ui_->search_field, &QSearchField::returnPressed, this, &CollectionFilterWidget::ReturnPressed);
@@ -319,7 +319,7 @@ QActionGroup *CollectionFilterWidget::CreateGroupByActions(const QString &saved_
if (version == 1) {
QStringList saved = s.childKeys();
for (int i = 0; i < saved.size(); ++i) {
if (saved.at(i) == QStringLiteral("version")) continue;
if (saved.at(i) == QLatin1String("version")) continue;
QByteArray bytes = s.value(saved.at(i)).toByteArray();
QDataStream ds(&bytes, QIODevice::ReadOnly);
CollectionModel::Grouping g;
@@ -330,7 +330,7 @@ QActionGroup *CollectionFilterWidget::CreateGroupByActions(const QString &saved_
else {
QStringList saved = s.childKeys();
for (int i = 0; i < saved.size(); ++i) {
if (saved.at(i) == QStringLiteral("version")) continue;
if (saved.at(i) == QLatin1String("version")) continue;
s.remove(saved.at(i));
}
}

View File

@@ -728,7 +728,7 @@ void CollectionModel::CreateDividerItem(const QString &divider_key, const QStrin
CollectionItem *divider = new CollectionItem(CollectionItem::Type::Divider, root_);
divider->container_key = divider_key;
divider->display_text = display_text;
divider->sort_text = divider_key + QStringLiteral(" ");
divider->sort_text = divider_key + QLatin1String(" ");
divider_nodes_[divider_key] = divider;
endInsertRows();
@@ -772,7 +772,7 @@ CollectionItem *CollectionModel::CreateCompilationArtistNode(CollectionItem *par
if (parent != root_ && !parent->container_key.isEmpty()) parent->compilation_artist_node_->container_key.append(parent->container_key);
parent->compilation_artist_node_->container_key.append(QLatin1String(kVariousArtists));
parent->compilation_artist_node_->display_text = QLatin1String(kVariousArtists);
parent->compilation_artist_node_->sort_text = QStringLiteral(" various");
parent->compilation_artist_node_->sort_text = QLatin1String(" various");
parent->compilation_artist_node_->container_level = parent->container_level + 1;
endInsertRows();
@@ -1031,14 +1031,14 @@ QString CollectionModel::TextOrUnknown(const QString &text) {
QString CollectionModel::PrettyYearAlbum(const int year, const QString &album) {
if (year <= 0) return TextOrUnknown(album);
return QString::number(year) + QStringLiteral(" - ") + TextOrUnknown(album);
return QString::number(year) + QLatin1String(" - ") + TextOrUnknown(album);
}
QString CollectionModel::PrettyAlbumDisc(const QString &album, const int disc) {
if (disc <= 0 || Song::AlbumContainsDisc(album)) return TextOrUnknown(album);
return TextOrUnknown(album) + QStringLiteral(" - (Disc ") + QString::number(disc) + QStringLiteral(")");
return TextOrUnknown(album) + QLatin1String(" - (Disc ") + QString::number(disc) + QLatin1String(")");
}
@@ -1047,9 +1047,9 @@ QString CollectionModel::PrettyYearAlbumDisc(const int year, const QString &albu
QString str;
if (year <= 0) str = TextOrUnknown(album);
else str = QString::number(year) + QStringLiteral(" - ") + TextOrUnknown(album);
else str = QString::number(year) + QLatin1String(" - ") + TextOrUnknown(album);
if (!Song::AlbumContainsDisc(album) && disc > 0) str += QStringLiteral(" - (Disc ") + QString::number(disc) + QStringLiteral(")");
if (!Song::AlbumContainsDisc(album) && disc > 0) str += QLatin1String(" - (Disc ") + QString::number(disc) + QLatin1String(")");
return str;
@@ -1057,7 +1057,7 @@ QString CollectionModel::PrettyYearAlbumDisc(const int year, const QString &albu
QString CollectionModel::PrettyDisc(const int disc) {
return QStringLiteral("Disc ") + QString::number(std::max(1, disc));
return QLatin1String("Disc ") + QString::number(std::max(1, disc));
}
@@ -1134,7 +1134,7 @@ QString CollectionModel::SortText(const GroupBy group_by, const int container_le
QString CollectionModel::SortText(QString text) {
if (text.isEmpty()) {
text = QStringLiteral(" unknown");
text = QLatin1String(" unknown");
}
else {
text = text.toLower();
@@ -1153,7 +1153,7 @@ QString CollectionModel::SortTextForArtist(QString artist, const bool skip_artic
for (const auto &i : Song::kArticles) {
if (artist.startsWith(i)) {
qint64 ilen = i.length();
artist = artist.right(artist.length() - ilen) + QStringLiteral(", ") + i.left(ilen - 1);
artist = artist.right(artist.length() - ilen) + QLatin1String(", ") + i.left(ilen - 1);
break;
}
}

View File

@@ -67,7 +67,7 @@ void CollectionQuery::AddWhere(const QString &column, const QVariant &value, con
QStringList final_values;
final_values.reserve(values.count());
for (const QString &single_value : values) {
final_values.append(QLatin1String("?"));
final_values.append(QStringLiteral("?"));
bound_values_ << single_value;
}

View File

@@ -165,7 +165,7 @@ void SavedGroupingManager::UpdateModel() {
if (version == 1) {
QStringList saved = s.childKeys();
for (int i = 0; i < saved.size(); ++i) {
if (saved.at(i) == QStringLiteral("version")) continue;
if (saved.at(i) == QLatin1String("version")) continue;
QByteArray bytes = s.value(saved.at(i)).toByteArray();
QDataStream ds(&bytes, QIODevice::ReadOnly);
CollectionModel::Grouping g;
@@ -183,7 +183,7 @@ void SavedGroupingManager::UpdateModel() {
else {
QStringList saved = s.childKeys();
for (int i = 0; i < saved.size(); ++i) {
if (saved.at(i) == QStringLiteral("version")) continue;
if (saved.at(i) == QLatin1String("version")) continue;
s.remove(saved.at(i));
}
}

View File

@@ -633,10 +633,10 @@ void ContextView::UpdateLyrics(const quint64 id, const QString &provider, const
if (static_cast<qint64>(id) != lyrics_id_) return;
if (lyrics.isEmpty()) {
lyrics_ = QStringLiteral("No lyrics found.\n");
lyrics_ = QLatin1String("No lyrics found.\n");
}
else {
lyrics_ = lyrics + QStringLiteral("\n\n(Lyrics from ") + provider + QStringLiteral(")\n");
lyrics_ = lyrics + QLatin1String("\n\n(Lyrics from ") + provider + QLatin1String(")\n");
}
lyrics_id_ = -1;

View File

@@ -311,7 +311,7 @@ bool CommandlineOptions::Parse() {
log_levels_ = OptArgToString(optarg);
break;
case LongOptions::Version:{
QString version_text = QString::fromUtf8(kVersionText).arg(QStringLiteral(STRAWBERRY_VERSION_DISPLAY));
QString version_text = QString::fromUtf8(kVersionText).arg(QLatin1String(STRAWBERRY_VERSION_DISPLAY));
std::cout << version_text.toLocal8Bit().constData() << std::endl;
std::exit(0);
}

View File

@@ -414,7 +414,7 @@ void Database::ExecSongTablesCommands(QSqlDatabase &db, const QStringList &song_
if (command.contains(QLatin1String(kMagicAllSongsTables))) {
for (const QString &table : song_tables) {
// Another horrible hack: device songs tables don't have matching _fts tables, so if this command tries to touch one, ignore it.
if (table.startsWith(QLatin1String("device_")) && command.contains(QLatin1String(kMagicAllSongsTables) + QStringLiteral("_fts"))) {
if (table.startsWith(QLatin1String("device_")) && command.contains(QLatin1String(kMagicAllSongsTables) + QLatin1String("_fts"))) {
continue;
}
@@ -450,7 +450,7 @@ QStringList Database::SongsTables(QSqlDatabase &db, const int schema_version) {
// look for the tables in the main db
const QStringList &tables = db.tables();
for (const QString &table : tables) {
if (table == QStringLiteral("songs") || table.endsWith(QLatin1String("_songs"))) ret << table;
if (table == QLatin1String("songs") || table.endsWith(QLatin1String("_songs"))) ret << table;
}
// look for the tables in attached dbs
@@ -460,7 +460,7 @@ QStringList Database::SongsTables(QSqlDatabase &db, const int schema_version) {
q.prepare(QStringLiteral("SELECT NAME FROM %1.sqlite_master WHERE type='table' AND name='songs' OR name LIKE '%songs'").arg(key));
if (q.Exec()) {
while (q.next()) {
QString tab_name = key + QStringLiteral(".") + q.value(0).toString();
QString tab_name = key + QLatin1Char('.') + q.value(0).toString();
ret << tab_name;
}
}

View File

@@ -1049,7 +1049,7 @@ MainWindow::MainWindow(Application *app, SharedPtr<SystemTrayIcon> tray_icon, OS
rosetta_message->set_settings_group(QLatin1String(kSettingsGroup));
rosetta_message->set_do_not_show_message_again(QStringLiteral("ignore_rosetta"));
rosetta_message->setAttribute(Qt::WA_DeleteOnClose);
rosetta_message->ShowMessage(tr("Strawberry running under Rosetta"), tr("You are running Strawberry under Rosetta. Running Strawberry under Rosetta is unsupported and known to have issues. You should download Strawberry for the correct CPU architecture from %1").arg(QStringLiteral("<a href=\"https://downloads.strawberrymusicplayer.org/\">downloads.strawberrymusicplayer.org</a>")), IconLoader::Load(QStringLiteral("dialog-warning")));
rosetta_message->ShowMessage(tr("Strawberry running under Rosetta"), tr("You are running Strawberry under Rosetta. Running Strawberry under Rosetta is unsupported and known to have issues. You should download Strawberry for the correct CPU architecture from %1").arg(QLatin1String("<a href=\"https://downloads.strawberrymusicplayer.org/\">downloads.strawberrymusicplayer.org</a>")), IconLoader::Load(QStringLiteral("dialog-warning")));
}
}
#endif
@@ -2366,7 +2366,7 @@ void MainWindow::ShowInCollection() {
}
QString search;
if (!songs.isEmpty()) {
search = QStringLiteral("artist:") + songs.first().artist() + QStringLiteral(" album:") + songs.first().album();
search = QLatin1String("artist:") + songs.first().artist() + QLatin1String(" album:") + songs.first().album();
}
collection_view_->filter_widget()->ShowInCollection(search);
@@ -2500,7 +2500,7 @@ void MainWindow::CommandlineOptionsReceived(const CommandlineOptions &options) {
#ifdef HAVE_TIDAL
for (const QUrl &url : options.urls()) {
if (url.scheme() == QStringLiteral("tidal") && url.host() == QStringLiteral("login")) {
if (url.scheme() == QLatin1String("tidal") && url.host() == QLatin1String("login")) {
emit AuthorizationUrlReceived(url);
return;
}
@@ -2943,9 +2943,9 @@ void MainWindow::CheckFullRescanRevisions() {
if (!reasons.isEmpty()) {
QString message = tr("The version of Strawberry you've just updated to requires a full collection rescan because of the new features listed below:") + QStringLiteral("<ul>");
for (const QString &reason : reasons) {
message += QStringLiteral("<li>") + reason + QStringLiteral("</li>");
message += QLatin1String("<li>") + reason + QLatin1String("</li>");
}
message += QStringLiteral("</ul>") + tr("Would you like to run a full rescan right now?");
message += QLatin1String("</ul>") + tr("Would you like to run a full rescan right now?");
if (QMessageBox::question(this, tr("Collection rescan notice"), message, QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) {
app_->collection()->FullScan();
}

View File

@@ -325,13 +325,13 @@ void Mpris2::SetLoopStatus(const QString &value) {
PlaylistSequence::RepeatMode mode = PlaylistSequence::RepeatMode::Off;
if (value == QStringLiteral("None")) {
if (value == QLatin1String("None")) {
mode = PlaylistSequence::RepeatMode::Off;
}
else if (value == QStringLiteral("Track")) {
else if (value == QLatin1String("Track")) {
mode = PlaylistSequence::RepeatMode::Track;
}
else if (value == QStringLiteral("Playlist")) {
else if (value == QLatin1String("Playlist")) {
mode = PlaylistSequence::RepeatMode::Playlist;
}

View File

@@ -1913,7 +1913,7 @@ void Song::MergeUserSetData(const Song &other, const bool merge_playcount, const
}
QString Song::AlbumKey() const {
return QStringLiteral("%1|%2|%3").arg(is_compilation() ? QStringLiteral("_compilation") : effective_albumartist(), has_cue() ? cue_path() : QLatin1String(""), effective_album());
return QStringLiteral("%1|%2|%3").arg(is_compilation() ? QLatin1String("_compilation") : effective_albumartist(), has_cue() ? cue_path() : QLatin1String(""), effective_album());
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)

View File

@@ -231,12 +231,12 @@ QUrl AlbumCoverChoiceController::LoadCoverFromFile(Song *song) {
void AlbumCoverChoiceController::SaveCoverToFileManual(const Song &song, const AlbumCoverImageResult &result) {
QString initial_file_name = QStringLiteral("/");
QString initial_file_name = QLatin1String("/");
if (!song.effective_albumartist().isEmpty()) {
initial_file_name = initial_file_name + song.effective_albumartist();
}
initial_file_name = initial_file_name + QLatin1Char('-') + (song.effective_album().isEmpty() ? tr("unknown") : song.effective_album()) + QStringLiteral(".jpg");
initial_file_name = initial_file_name + QLatin1Char('-') + (song.effective_album().isEmpty() ? tr("unknown") : song.effective_album()) + QLatin1String(".jpg");
initial_file_name = initial_file_name.toLower();
initial_file_name.replace(QRegularExpression(QStringLiteral("\\s")), QStringLiteral("-"));
initial_file_name.remove(QRegularExpression(QLatin1String(kInvalidFatCharactersRegex), QRegularExpression::CaseInsensitiveOption));
@@ -247,12 +247,12 @@ void AlbumCoverChoiceController::SaveCoverToFileManual(const Song &song, const A
QFileInfo fileinfo(save_filename);
if (fileinfo.suffix().isEmpty()) {
save_filename.append(QStringLiteral(".jpg"));
save_filename.append(QLatin1String(".jpg"));
fileinfo.setFile(save_filename);
}
if (!QImageWriter::supportedImageFormats().contains(fileinfo.completeSuffix().toUtf8().toLower())) {
save_filename = Utilities::PathWithoutFilenameExtension(save_filename) + QStringLiteral(".jpg");
save_filename = Utilities::PathWithoutFilenameExtension(save_filename) + QLatin1String(".jpg");
fileinfo.setFile(save_filename);
}
@@ -473,13 +473,13 @@ void AlbumCoverChoiceController::ShowCover(const Song &song, const QPixmap &pixm
// Use Artist - Album as the window title
QString title_text(song.effective_albumartist());
if (!song.effective_album().isEmpty()) title_text += QStringLiteral(" - ") + song.effective_album();
if (!song.effective_album().isEmpty()) title_text += QLatin1String(" - ") + song.effective_album();
QLabel *label = new QLabel(dialog);
label->setPixmap(pixmap);
// Add (WxHpx) to the title before possibly resizing
title_text += QStringLiteral(" (") + QString::number(pixmap.width()) + QLatin1Char('x') + QString::number(pixmap.height()) + QStringLiteral("px)");
title_text += QLatin1String(" (") + QString::number(pixmap.width()) + QLatin1Char('x') + QString::number(pixmap.height()) + QLatin1String("px)");
// If the cover is larger than the screen, resize the window 85% seems to be enough to account for title bar and taskbar etc.
QScreen *screen = Utilities::GetScreen(this);
@@ -656,7 +656,7 @@ QUrl AlbumCoverChoiceController::SaveCoverToFileAutomatic(const Song::Source sou
const AlbumCoverImageResult &result,
const bool force_overwrite) {
QString filepath = CoverUtils::CoverFilePath(cover_options_, source, artist, album, album_id, album_dir, result.cover_url, QStringLiteral("jpg"));
QString filepath = CoverUtils::CoverFilePath(cover_options_, source, artist, album, album_id, album_dir, result.cover_url, QLatin1String("jpg"));
if (filepath.isEmpty()) return QUrl();
QFile file(filepath);
@@ -664,7 +664,7 @@ QUrl AlbumCoverChoiceController::SaveCoverToFileAutomatic(const Song::Source sou
if (source == Song::Source::Collection && !cover_options_.cover_overwrite && !force_overwrite && get_save_album_cover_type() == CoverOptions::CoverType::Album && cover_options_.cover_filename == CoverOptions::CoverFilename::Pattern && file.exists()) {
while (file.exists()) {
QFileInfo fileinfo(file.fileName());
file.setFileName(fileinfo.path() + QStringLiteral("/0") + fileinfo.fileName());
file.setFileName(fileinfo.path() + QLatin1String("/0") + fileinfo.fileName());
}
filepath = file.fileName();
}

View File

@@ -39,16 +39,16 @@ AlbumCoverLoaderOptions::Types AlbumCoverLoaderOptions::LoadTypes() {
const QStringList all_cover_types = QStringList() << QStringLiteral("art_unset") << QStringLiteral("art_embedded") << QStringLiteral("art_manual") << QStringLiteral("art_automatic");
const QStringList cover_types_strlist = s.value(CoversSettingsPage::kTypes, all_cover_types).toStringList();
for (const QString &cover_type_str : cover_types_strlist) {
if (cover_type_str == QStringLiteral("art_unset")) {
if (cover_type_str == QLatin1String("art_unset")) {
cover_types << AlbumCoverLoaderOptions::Type::Unset;
}
else if (cover_type_str == QStringLiteral("art_embedded")) {
else if (cover_type_str == QLatin1String("art_embedded")) {
cover_types << AlbumCoverLoaderOptions::Type::Embedded;
}
else if (cover_type_str == QStringLiteral("art_manual")) {
else if (cover_type_str == QLatin1String("art_manual")) {
cover_types << AlbumCoverLoaderOptions::Type::Manual;
}
else if (cover_type_str == QStringLiteral("art_automatic")) {
else if (cover_type_str == QLatin1String("art_automatic")) {
cover_types << AlbumCoverLoaderOptions::Type::Automatic;
}
}

View File

@@ -281,10 +281,10 @@ void AlbumCoverManager::LoadGeometry() {
Settings s;
s.beginGroup(kSettingsGroup);
if (s.contains(QStringLiteral("geometry"))) {
if (s.contains(QLatin1String("geometry"))) {
restoreGeometry(s.value("geometry").toByteArray());
}
if (s.contains(QStringLiteral("splitter_state"))) {
if (s.contains(QLatin1String("splitter_state"))) {
ui_->splitter->restoreState(s.value("splitter_state").toByteArray());
}
else {
@@ -397,7 +397,7 @@ void AlbumCoverManager::ArtistChanged(QListWidgetItem *current) {
display_text = album_info.album;
}
else {
display_text = album_info.album_artist + QStringLiteral(" - ") + album_info.album;
display_text = album_info.album_artist + QLatin1String(" - ") + album_info.album;
}
AlbumItem *album_item = new AlbumItem(icon_nocover_item_, display_text, ui_->albums);
@@ -413,7 +413,7 @@ void AlbumCoverManager::ArtistChanged(QListWidgetItem *current) {
album_item->setToolTip(album_info.album);
}
else {
album_item->setToolTip(album_info.album_artist + QStringLiteral(" - ") + album_info.album);
album_item->setToolTip(album_info.album_artist + QLatin1String(" - ") + album_info.album);
}
album_item->setData(Role_ArtEmbedded, album_info.art_embedded);
@@ -558,7 +558,7 @@ void AlbumCoverManager::UpdateStatusText() {
.arg(fetch_statistics_.missing_images_);
if (fetch_statistics_.bytes_transferred_ > 0) {
message += QStringLiteral(", ") + tr("%1 transferred").arg(Utilities::PrettySize(fetch_statistics_.bytes_transferred_));
message += QLatin1String(", ") + tr("%1 transferred").arg(Utilities::PrettySize(fetch_statistics_.bytes_transferred_));
}
statusBar()->showMessage(message);
@@ -632,7 +632,7 @@ Song AlbumCoverManager::AlbumItemAsSong(AlbumItem *album_item) {
QString title = album_item->data(Role_Album).toString();
QString artist_name = album_item->data(Role_AlbumArtist).toString();
if (!artist_name.isEmpty()) {
result.set_title(artist_name + QStringLiteral(" - ") + title);
result.set_title(artist_name + QLatin1String(" - ") + title);
}
else {
result.set_title(title);

View File

@@ -78,7 +78,7 @@ void CoverExportRunnable::ProcessAndExportCover() {
if (song_.art_embedded() && dialog_result_.export_embedded_) {
image = TagReaderClient::Instance()->LoadEmbeddedArtAsImageBlocking(song_.url().toLocalFile());
if (!image.isNull()) {
extension = QStringLiteral("jpg");
extension = QLatin1String("jpg");
}
}
break;
@@ -113,7 +113,7 @@ void CoverExportRunnable::ProcessAndExportCover() {
}
QString cover_dir = song_.url().toLocalFile().section(QLatin1Char('/'), 0, -2);
QString new_file = cover_dir + QLatin1Char('/') + dialog_result_.filename_ + QLatin1Char('.') + (song_.art_embedded() ? QStringLiteral("jpg") : extension);
QString new_file = cover_dir + QLatin1Char('/') + dialog_result_.filename_ + QLatin1Char('.') + (song_.art_embedded() ? QLatin1String("jpg") : extension);
// If the file exists, do not override!
if (dialog_result_.overwrite_ == AlbumCoverExport::OverwriteMode::None && QFile::exists(new_file)) {
@@ -171,7 +171,7 @@ void CoverExportRunnable::ExportCover() {
image = TagReaderClient::Instance()->LoadEmbeddedArtAsImageBlocking(song_.url().toLocalFile());
if (!image.isNull()) {
embedded_cover = true;
extension = QStringLiteral("jpg");
extension = QLatin1String("jpg");
}
}
break;

View File

@@ -60,7 +60,7 @@ ConnectedDevice::ConnectedDevice(const QUrl &url, DeviceLister *lister, const QS
backend_->moveToThread(app_->database()->thread());
qLog(Debug) << &*backend_ << "for device" << unique_id_ << "moved to thread" << app_->database()->thread();
if (url_.scheme() != QStringLiteral("cdda")) {
if (url_.scheme() != QLatin1String("cdda")) {
QObject::connect(&*backend_, &CollectionBackend::TotalSongCountUpdated, this, &ConnectedDevice::BackendTotalSongCountUpdated);
}

View File

@@ -140,7 +140,7 @@ int DeviceDatabaseBackend::AddDevice(const Device &device) {
int id = q.lastInsertId().toInt();
// Create the songs tables for the device
QString filename(QStringLiteral(":/schema/device-schema.sql"));
QString filename(QLatin1String(":/schema/device-schema.sql"));
QFile schema_file(filename);
if (!schema_file.open(QIODevice::ReadOnly)) {
qFatal("Couldn't open schema file %s: %s", filename.toUtf8().constData(), schema_file.errorString().toUtf8().constData());

View File

@@ -90,7 +90,7 @@ const DeviceInfo::Backend *DeviceInfo::BestBackend() const {
void DeviceInfo::LoadIcon(const QVariantList &icons, const QString &name_hint) {
icon_name_ = QStringLiteral("device");
icon_name_ = QLatin1String("device");
if (icons.isEmpty()) {
icon_ = IconLoader::Load(icon_name_);
@@ -121,10 +121,10 @@ void DeviceInfo::LoadIcon(const QVariantList &icons, const QString &name_hint) {
QString icon_name = icon.toString();
if (!icon_name.isEmpty()) {
QString hint = icons.first().toString().toLower() + name_hint.toLower();
if (hint.contains(QLatin1String("phone"))) icon_name_ = QStringLiteral("device-phone");
else if (hint.contains(QLatin1String("ipod")) || hint.contains(QLatin1String("apple"))) icon_name_ = QStringLiteral("device-ipod");
else if ((hint.contains(QLatin1String("usb"))) && (hint.contains(QLatin1String("reader")))) icon_name_ = QStringLiteral("device-usb-flash");
else if (hint.contains(QLatin1String("usb"))) icon_name_ = QStringLiteral("device-usb-drive");
if (hint.contains(QLatin1String("phone"))) icon_name_ = QLatin1String("device-phone");
else if (hint.contains(QLatin1String("ipod")) || hint.contains(QLatin1String("apple"))) icon_name_ = QLatin1String("device-ipod");
else if ((hint.contains(QLatin1String("usb"))) && (hint.contains(QLatin1String("reader")))) icon_name_ = QLatin1String("device-usb-flash");
else if (hint.contains(QLatin1String("usb"))) icon_name_ = QLatin1String("device-usb-drive");
icon_ = IconLoader::Load(icon_name_);
if (!icon_.isNull()) {
return;
@@ -133,7 +133,7 @@ void DeviceInfo::LoadIcon(const QVariantList &icons, const QString &name_hint) {
}
}
icon_name_ = QStringLiteral("device");
icon_name_ = QLatin1String("device");
icon_ = IconLoader::Load(icon_name_);
}

View File

@@ -223,9 +223,9 @@ QUrl DeviceLister::MakeUrlFromLocalPath(const QString &path) const {
}
bool DeviceLister::IsIpod(const QString &path) {
return QFile::exists(path + QStringLiteral("/iTunes_Control")) ||
QFile::exists(path + QStringLiteral("/iPod_Control")) ||
QFile::exists(path + QStringLiteral("/iTunes/iTunes_Control"));
return QFile::exists(path + QLatin1String("/iTunes_Control")) ||
QFile::exists(path + QLatin1String("/iPod_Control")) ||
QFile::exists(path + QLatin1String("/iTunes/iTunes_Control"));
}
QVariantList DeviceLister::GuessIconForPath(const QString &path) {

View File

@@ -604,7 +604,7 @@ SharedPtr<ConnectedDevice> DeviceManager::Connect(DeviceInfo *info) {
// If we get here it means that this URL scheme wasn't supported.
// If it was "ipod" or "mtp" then the user compiled out support and the device won't work properly.
if (url.scheme() == QStringLiteral("mtp") || url.scheme() == QStringLiteral("gphoto2")) {
if (url.scheme() == QLatin1String("mtp") || url.scheme() == QLatin1String("gphoto2")) {
if (QMessageBox::critical(nullptr, tr("This device will not work properly"),
tr("This is an MTP device, but you compiled Strawberry without libmtp support.") + QStringLiteral(" ") +
tr("If you continue, this device will work slowly and songs copied to it may not work."),
@@ -612,9 +612,9 @@ SharedPtr<ConnectedDevice> DeviceManager::Connect(DeviceInfo *info) {
return ret;
}
if (url.scheme() == QStringLiteral("ipod")) {
if (url.scheme() == QLatin1String("ipod")) {
if (QMessageBox::critical(nullptr, tr("This device will not work properly"),
tr("This is an iPod, but you compiled Strawberry without libgpod support.") + QStringLiteral(" ") +
tr("This is an iPod, but you compiled Strawberry without libgpod support.") + QLatin1String(" ") +
tr("If you continue, this device will work slowly and songs copied to it may not work."),
QMessageBox::Abort, QMessageBox::Ignore) == QMessageBox::Abort)
return ret;

View File

@@ -69,7 +69,7 @@ bool GioLister::DeviceInfo::is_suitable() const {
if (filesystem_type.isEmpty()) return true;
return filesystem_type != QStringLiteral("udf") && filesystem_type != QStringLiteral("smb") && filesystem_type != QStringLiteral("cifs") && filesystem_type != QStringLiteral("ssh") && filesystem_type != QStringLiteral("isofs");
return filesystem_type != QLatin1String("udf") && filesystem_type != QLatin1String("smb") && filesystem_type != QLatin1String("cifs") && filesystem_type != QLatin1String("ssh") && filesystem_type != QLatin1String("isofs");
}
@@ -503,7 +503,7 @@ void GioLister::DeviceInfo::ReadMountInfo(GMount *mount) {
// Query the file's info for a filesystem ID
// Only afc devices (that I know of) give reliably unique IDs
if (filesystem_type == QStringLiteral("afc")) {
if (filesystem_type == QLatin1String("afc")) {
error = nullptr;
info = g_file_query_info(root, G_FILE_ATTRIBUTE_ID_FILESYSTEM, G_FILE_QUERY_INFO_NONE, nullptr, &error);
if (error) {

View File

@@ -138,9 +138,9 @@ bool MacOsDeviceLister::Init() {
}
MTPDevice d;
d.vendor = QStringLiteral("SanDisk");
d.vendor = QLatin1String("SanDisk");
d.vendor_id = 0x781;
d.product = QStringLiteral("Sansa Clip+");
d.product = QLatin1String("Sansa Clip+");
d.product_id = 0x74d0;
d.quirks = 0x2 | 0x4 | 0x40 | 0x4000;
@@ -303,7 +303,7 @@ QString GetIconForDevice(io_object_t device) {
scoped_nsobject<NSURL> bundle_url(reinterpret_cast<NSURL*>(KextManagerCreateURLForBundleIdentifier(kCFAllocatorDefault, reinterpret_cast<CFStringRef>(bundle))));
QString path = QString::fromUtf8([[bundle_url path] UTF8String]);
path += QStringLiteral("/Contents/Resources/");
path += QLatin1String("/Contents/Resources/");
path += QString::fromUtf8([file UTF8String]);
return path;
}
@@ -316,7 +316,7 @@ QString GetSerialForDevice(io_object_t device) {
const QString serial = GetUSBRegistryEntryString(device, CFSTR(kUSBSerialNumberString));
if (!serial.isEmpty()) {
return QStringLiteral("USB/") + serial;
return QLatin1String("USB/") + serial;
}
return QString();
@@ -326,7 +326,7 @@ QString GetSerialForDevice(io_object_t device) {
QString GetSerialForMTPDevice(io_object_t device) {
scoped_nsobject<NSString> serial(reinterpret_cast<NSString*>(GetPropertyForDevice(device, CFSTR(kUSBSerialNumberString))));
return QString(QStringLiteral("MTP/") + QString::fromUtf8([serial UTF8String]));
return QLatin1String("MTP/") + QString::fromUtf8([serial UTF8String]);
}
@@ -600,14 +600,14 @@ void MacOsDeviceLister::USBDeviceAddedCallback(void *refcon, io_iterator_t it) {
// Because this was designed by MS, the characters are in UTF-16 (LE?).
QString str = QString::fromUtf16(reinterpret_cast<char16_t*>(data.data() + 2), (data.size() / 2) - 2);
if (str.startsWith(QStringLiteral("MSFT100"))) {
if (str.startsWith(QLatin1String("MSFT100"))) {
// We got the OS descriptor!
char vendor_code = data[16];
ret = DeviceRequest(dev, kUSBIn, kUSBVendor, kUSBDevice, vendor_code, 0, 4, 256, &data);
if (!ret || data.at(0) != 0x28)
continue;
if (QString::fromLatin1(data.data() + 0x12, 3) != QStringLiteral("MTP")) {
if (QString::fromLatin1(data.data() + 0x12, 3) != QLatin1String("MTP")) {
// Not quite.
continue;
}
@@ -617,7 +617,7 @@ void MacOsDeviceLister::USBDeviceAddedCallback(void *refcon, io_iterator_t it) {
continue;
}
if (QString::fromLatin1(data.data() + 0x12, 3) != QStringLiteral("MTP")) {
if (QString::fromLatin1(data.data() + 0x12, 3) != QLatin1String("MTP")) {
// Not quite.
continue;
}
@@ -678,7 +678,7 @@ void MacOsDeviceLister::FoundMTPDevice(const MTPDevice &device, const QString &s
}
bool IsMTPSerial(const QString &serial) { return serial.startsWith(QStringLiteral("MTP")); }
bool IsMTPSerial(const QString &serial) { return serial.startsWith(QLatin1String("MTP")); }
bool MacOsDeviceLister::IsCDDevice(const QString &serial) const {
return cd_devices_.contains(serial);

View File

@@ -226,17 +226,17 @@ void Udisks2Lister::DBusInterfaceAdded(const QDBusObjectPath &path, const Interf
for (auto interface = interfaces.constBegin(); interface != interfaces.constEnd(); ++interface) {
if (interface.key() != QStringLiteral("org.freedesktop.UDisks2.Job")) continue;
if (interface.key() != QLatin1String("org.freedesktop.UDisks2.Job")) continue;
SharedPtr<OrgFreedesktopUDisks2JobInterface> job = make_shared<OrgFreedesktopUDisks2JobInterface>(QLatin1String(kUDisks2Service), path.path(), QDBusConnection::systemBus());
if (!job->isValid()) continue;
bool is_mount_job = false;
if (job->operation() == QStringLiteral("filesystem-mount")) {
if (job->operation() == QLatin1String("filesystem-mount")) {
is_mount_job = true;
}
else if (job->operation() == QStringLiteral("filesystem-unmount")) {
else if (job->operation() == QLatin1String("filesystem-unmount")) {
is_mount_job = false;
}
else {

View File

@@ -38,56 +38,56 @@ SnapDialog::SnapDialog(QWidget *parent) : MessageDialog(parent) {
ui_->label_logo->setPixmap(pixmap);
QString text;
text += QStringLiteral("<p>");
text += QLatin1String("<p>");
text += tr("It is detected that Strawberry is running as a Snap");
text += QStringLiteral("</p>");
text += QLatin1String("</p>");
text += QStringLiteral("<p>");
text += QLatin1String("<p>");
text += tr("Strawberry is slower, and has restrictions when running as a Snap. Accessing the root filesystem (/) will not work. There also might be other restrictions such as accessing certain devices or network shares.");
text += QStringLiteral("</p>");
text += QLatin1String("</p>");
text += QStringLiteral("<p>");
text += QStringLiteral("Strawberry is available natively in the official package repositories for Fedora, openSUSE, Mageia, Arch, Manjaro, MX Linux and most other popular Linux distributions.");
text += QStringLiteral("</p>");
text += QLatin1String("<p>");
text += QLatin1String("Strawberry is available natively in the official package repositories for Fedora, openSUSE, Mageia, Arch, Manjaro, MX Linux and most other popular Linux distributions.");
text += QLatin1String("</p>");
text += QStringLiteral("<p>");
text += tr("For Ubuntu there is an official PPA repository available at %1.").arg(QStringLiteral("<a style=\"color:%1;\" href=\"https://launchpad.net/~jonaski/+archive/ubuntu/strawberry\">https://launchpad.net/~jonaski/+archive/ubuntu/strawberry</a>").arg(palette().text().color().name()));
text += QStringLiteral("</p>");
text += QLatin1String("<p>");
text += tr("For Ubuntu there is an official PPA repository available at %1.").arg(QLatin1String("<a style=\"color:%1;\" href=\"https://launchpad.net/~jonaski/+archive/ubuntu/strawberry\">https://launchpad.net/~jonaski/+archive/ubuntu/strawberry</a>").arg(palette().text().color().name()));
text += QLatin1String("</p>");
text += QStringLiteral("<p>");
text += QLatin1String("<p>");
text += tr("Official releases are available for Debian and Ubuntu which also work on most of their derivatives. See %1 for more information.").arg(QStringLiteral("<a style=\"color:%1;\" href=\"https://www.strawberrymusicplayer.org/\">https://www.strawberrymusicplayer.org/</a>").arg(palette().text().color().name()));
text += QStringLiteral("</p>");
text += QLatin1String("</p>");
text += QStringLiteral("<p>");
text += QLatin1String("<p>");
text += tr("For a better experience please consider the other options above.");
text += QStringLiteral("</p>");
text += QLatin1String("</p>");
text += QStringLiteral("<p>");
text += QLatin1String("<p>");
text += tr("Copy your strawberry.conf and strawberry.db from your ~/snap directory to avoid losing configuration before you uninstall the snap:");
text += QStringLiteral("<br />");
text += QStringLiteral("cp ~/snap/strawberry/current/.config/strawberry/strawberry.conf ~/.config/strawberry/strawberry.conf<br />");
text += QStringLiteral("cp ~/snap/strawberry/current/.local/share/strawberry/strawberry/strawberry.db ~/.local/share/strawberry/strawberry/strawberry.db<br />");
text += QStringLiteral("</p>");
text += QStringLiteral("<p>");
text += QLatin1String("<br />");
text += QLatin1String("cp ~/snap/strawberry/current/.config/strawberry/strawberry.conf ~/.config/strawberry/strawberry.conf<br />");
text += QLatin1String("cp ~/snap/strawberry/current/.local/share/strawberry/strawberry/strawberry.db ~/.local/share/strawberry/strawberry/strawberry.db<br />");
text += QLatin1String("</p>");
text += QLatin1String("<p>");
text += tr("Uninstall the snap with:");
text += QStringLiteral("<br />");
text += QStringLiteral("snap remove strawberry");
text += QStringLiteral("</p>");
text += QStringLiteral("<p>");
text += QLatin1String("<br />");
text += QLatin1String("snap remove strawberry");
text += QLatin1String("</p>");
text += QLatin1String("<p>");
text += tr("Install strawberry through PPA:");
text += QStringLiteral("<br />");
text += QStringLiteral("sudo add-apt-repository ppa:jonaski/strawberry<br />");
text += QStringLiteral("sudo apt-get update<br />");
text += QStringLiteral("sudo apt install strawberry");
text += QStringLiteral("</p>");
text += QStringLiteral("<p></p>");
text += QLatin1String("<br />");
text += QLatin1String("sudo add-apt-repository ppa:jonaski/strawberry<br />");
text += QLatin1String("sudo apt-get update<br />");
text += QLatin1String("sudo apt install strawberry");
text += QLatin1String("</p>");
text += QLatin1String("<p></p>");
ui_->label_text->setText(text);
ui_->label_text->adjustSize();
adjustSize();
settings_group_ = QLatin1String(MainWindow::kSettingsGroup);
do_not_show_message_again_ = QStringLiteral("ignore_snap");
do_not_show_message_again_ = QLatin1String("ignore_snap");
if (parent) {
Utilities::CenterWidgetOnScreen(Utilities::GetScreen(parent), this);

View File

@@ -216,16 +216,16 @@ FrameFormat::FrameFormat(GstCaps *caps) : channels(0), channel_mask(0), samplera
channel_mask = gst_value_get_bitmask(value);
}
if (format_str == QStringLiteral("S16LE")) {
if (format_str == QLatin1String("S16LE")) {
format = DataFormat::S16;
}
else if (format_str == QStringLiteral("S32LE")) {
else if (format_str == QLatin1String("S32LE")) {
format = DataFormat::S32;
}
else if (format_str == QStringLiteral("F32LE")) {
else if (format_str == QLatin1String("F32LE")) {
format = DataFormat::FP32;
}
else if (format_str == QStringLiteral("F64LE")) {
else if (format_str == QLatin1String("F64LE")) {
format = DataFormat::FP64;
}
else {

View File

@@ -418,23 +418,23 @@ EngineBase::OutputDetailsList GstEngine::GetOutputsList() const {
const QString metadata = QString::fromUtf8(gst_element_factory_get_metadata(factory, GST_ELEMENT_METADATA_KLASS));
const QString name = QString::fromUtf8(gst_plugin_feature_get_name(future->data));
const QStringList classes = metadata.split(QLatin1Char('/'));
if (classes.contains(QStringLiteral("Audio"), Qt::CaseInsensitive) && (classes.contains(QStringLiteral("Sink"), Qt::CaseInsensitive) || (classes.contains(QStringLiteral("Source"), Qt::CaseInsensitive) && name.contains(QStringLiteral("sink"))))) {
if (classes.contains(QLatin1String("Audio"), Qt::CaseInsensitive) && (classes.contains(QLatin1String("Sink"), Qt::CaseInsensitive) || (classes.contains(QLatin1String("Source"), Qt::CaseInsensitive) && name.contains(QLatin1String("sink"))))) {
QString description = QString::fromUtf8(gst_element_factory_get_metadata(factory, GST_ELEMENT_METADATA_DESCRIPTION));
if (name == QStringLiteral("wasapi2sink") && description == QStringLiteral("Stream audio to an audio capture device through WASAPI")) {
if (name == QLatin1String("wasapi2sink") && description == QLatin1String("Stream audio to an audio capture device through WASAPI")) {
description.append(QLatin1Char('2'));
}
else if (name == QStringLiteral("pipewiresink") && description == QStringLiteral("Send video to PipeWire")) {
description = QStringLiteral("Send audio to PipeWire");
else if (name == QLatin1String("pipewiresink") && description == QLatin1String("Send video to PipeWire")) {
description = QLatin1String("Send audio to PipeWire");
}
OutputDetails output;
output.name = name;
output.description = description;
if (output.name == QLatin1String(kAutoSink)) output.iconname = QStringLiteral("soundcard");
else if (output.name == QLatin1String(kALSASink) || output.name == QLatin1String(kOSS4Sink)) output.iconname = QStringLiteral("alsa");
else if (output.name == QLatin1String(kJackAudioSink)) output.iconname = QStringLiteral("jack");
else if (output.name == QLatin1String(kPulseSink)) output.iconname = QStringLiteral("pulseaudio");
else if (output.name == QLatin1String(kA2DPSink) || output.name == QLatin1String(kAVDTPSink)) output.iconname = QStringLiteral("bluetooth");
else output.iconname = QStringLiteral("soundcard");
if (output.name == QLatin1String(kAutoSink)) output.iconname = QLatin1String("soundcard");
else if (output.name == QLatin1String(kALSASink) || output.name == QLatin1String(kOSS4Sink)) output.iconname = QLatin1String("alsa");
else if (output.name == QLatin1String(kJackAudioSink)) output.iconname = QLatin1String("jack");
else if (output.name == QLatin1String(kPulseSink)) output.iconname = QLatin1String("pulseaudio");
else if (output.name == QLatin1String(kA2DPSink) || output.name == QLatin1String(kAVDTPSink)) output.iconname = QLatin1String("bluetooth");
else output.iconname = QLatin1String("soundcard");
outputs << output;
}
}
@@ -724,10 +724,10 @@ QByteArray GstEngine::FixupUrl(const QUrl &url) {
// QUrl::fromLocalFile does this when given a \\host\share\file path on Windows.
// Munge it back into a path that gstreamer will recognise.
if (url.isLocalFile() && !url.host().isEmpty()) {
QString str = QStringLiteral("file:////") + url.host() + url.path();
QString str = QLatin1String("file:////") + url.host() + url.path();
uri = str.toUtf8();
}
else if (url.scheme() == QStringLiteral("cdda")) {
else if (url.scheme() == QLatin1String("cdda")) {
QString str;
if (url.path().isEmpty()) {
str = url.toString();
@@ -952,7 +952,7 @@ void GstEngine::StreamDiscovered(GstDiscoverer*, GstDiscovererInfo *info, GError
GstStructure *gst_structure = gst_caps_get_structure(caps, i);
if (!gst_structure) continue;
QString mimetype = QString::fromUtf8(gst_structure_get_name(gst_structure));
if (!mimetype.isEmpty() && mimetype != QStringLiteral("audio/mpeg")) {
if (!mimetype.isEmpty() && mimetype != QLatin1String("audio/mpeg")) {
engine_metadata.filetype = Song::FiletypeByMimetype(mimetype);
if (engine_metadata.filetype == Song::FileType::Unknown) {
qLog(Error) << "Unknown mimetype" << mimetype;

View File

@@ -321,7 +321,7 @@ QString GstEnginePipeline::GstStateText(const GstState state) {
GstElement *GstEnginePipeline::CreateElement(const QString &factory_name, const QString &name, GstElement *bin, QString &error) const {
QString unique_name = QStringLiteral("pipeline") + QLatin1Char('-') + QString::number(id_) + QLatin1Char('-') + (name.isEmpty() ? factory_name : name);
QString unique_name = QLatin1String("pipeline") + QLatin1Char('-') + QString::number(id_) + QLatin1Char('-') + (name.isEmpty() ? factory_name : name);
GstElement *element = gst_element_factory_make(factory_name.toUtf8().constData(), unique_name.toUtf8().constData());
if (!element) {
@@ -751,7 +751,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
// Link replaygain elements if enabled.
if (rg_enabled_ && rgvolume && rglimiter && rgconverter) {
if (!gst_element_link_many(element_link, rgvolume, rglimiter, rgconverter, nullptr)) {
error = QStringLiteral("Failed to link replaygain volume, limiter and converter elements.");
error = QLatin1String("Failed to link replaygain volume, limiter and converter elements.");
return false;
}
element_link = rgconverter;
@@ -764,7 +764,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
"format = (string) { F32LE, F64LE }");
GstCaps *raw_fp_audio_caps = gst_static_caps_get(&static_raw_fp_audio_caps);
if (!gst_element_link_filtered(element_link, volume_ebur128_, raw_fp_audio_caps)) {
error = QStringLiteral("Failed to link EBU R 128 volume element.");
error = QLatin1String("Failed to link EBU R 128 volume element.");
return false;
}
gst_caps_unref(raw_fp_audio_caps);
@@ -774,7 +774,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
// Link equalizer elements if enabled.
if (eq_enabled_ && equalizer_ && equalizer_preamp_) {
if (!gst_element_link_many(element_link, equalizer_preamp_, equalizer_, nullptr)) {
error = QStringLiteral("Failed to link equalizer and equalizer preamp elements.");
error = QLatin1String("Failed to link equalizer and equalizer preamp elements.");
return false;
}
element_link = equalizer_;
@@ -783,7 +783,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
// Link stereo balancer elements if enabled.
if (stereo_balancer_enabled_ && audiopanorama_) {
if (!gst_element_link(element_link, audiopanorama_)) {
error = QStringLiteral("Failed to link audio panorama (stereo balancer).");
error = QLatin1String("Failed to link audio panorama (stereo balancer).");
return false;
}
element_link = audiopanorama_;
@@ -792,7 +792,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
// Link software volume element if enabled.
if (volume_enabled_ && volume_sw_) {
if (!gst_element_link(element_link, volume_sw_)) {
error = QStringLiteral("Failed to link software volume.");
error = QLatin1String("Failed to link software volume.");
return false;
}
element_link = volume_sw_;
@@ -801,7 +801,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
// Link fading volume element if enabled.
if (fading_enabled_ && volume_fading_) {
if (!gst_element_link(element_link, volume_fading_)) {
error = QStringLiteral("Failed to link fading volume.");
error = QLatin1String("Failed to link fading volume.");
return false;
}
element_link = volume_fading_;
@@ -811,21 +811,21 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
if (bs2b_enabled_ && bs2b) {
qLog(Debug) << "Enabling bs2b";
if (!gst_element_link(element_link, bs2b)) {
error = QStringLiteral("Failed to link bs2b.");
error = QLatin1String("Failed to link bs2b.");
return false;
}
element_link = bs2b;
}
if (!gst_element_link(element_link, audiosinkconverter)) {
error = QStringLiteral("Failed to link audio sink converter.");
error = QLatin1String("Failed to link audio sink converter.");
return false;
}
{
GstCaps *caps = gst_caps_new_empty_simple("audio/x-raw");
if (!caps) {
error = QStringLiteral("Failed to create caps for raw audio.");
error = QLatin1String("Failed to create caps for raw audio.");
return false;
}
if (channels_enabled_ && channels_ > 0) {
@@ -835,7 +835,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
const bool link_filtered_result = gst_element_link_filtered(audiosinkconverter, audiosink_, caps);
gst_caps_unref(caps);
if (!link_filtered_result) {
error = QStringLiteral("Failed to link audio sink converter to audio sink with filter for ") + output_;
error = QLatin1String("Failed to link audio sink converter to audio sink with filter for ") + output_;
return false;
}
}
@@ -926,7 +926,7 @@ void GstEnginePipeline::ElementAddedCallback(GstBin *bin, GstBin*, GstElement *e
const QString element_name = QString::fromUtf8(element_name_char);
g_free(element_name_char);
if (bin != GST_BIN(instance->audiobin_) || element_name == QStringLiteral("fake-audio-sink") || GST_ELEMENT(gst_element_get_parent(element)) != instance->audiosink_) return;
if (bin != GST_BIN(instance->audiobin_) || element_name == QLatin1String("fake-audio-sink") || GST_ELEMENT(gst_element_get_parent(element)) != instance->audiosink_) return;
GstElement *volume = nullptr;
if (GST_IS_STREAM_VOLUME(element)) {
@@ -1456,7 +1456,7 @@ void GstEnginePipeline::ErrorMessageReceived(GstMessage *msg) {
#ifdef Q_OS_WIN
// Ignore non-error received for directsoundsink: "IDirectSoundBuffer_GetStatus The operation completed successfully"
if (code == GST_RESOURCE_ERROR_OPEN_WRITE && message.contains(QStringLiteral("IDirectSoundBuffer_GetStatus The operation completed successfully."))) {
if (code == GST_RESOURCE_ERROR_OPEN_WRITE && message.contains(QLatin1String("IDirectSoundBuffer_GetStatus The operation completed successfully."))) {
return;
}
#endif
@@ -1486,7 +1486,7 @@ void GstEnginePipeline::TagMessageReceived(GstMessage *msg) {
if (!engine_metadata.title.isEmpty() && engine_metadata.artist.isEmpty() && engine_metadata.album.isEmpty()) {
QStringList title_splitted;
if (engine_metadata.title.contains(QLatin1String(" - "))) {
title_splitted = engine_metadata.title.split(QStringLiteral(" - "));
title_splitted = engine_metadata.title.split(QLatin1String(" - "));
}
else if (engine_metadata.title.contains(QLatin1Char('~'))) {
title_splitted = engine_metadata.title.split(QLatin1Char('~'));

View File

@@ -115,28 +115,28 @@ void GstStartup::SetEnvironment() {
// Set plugin root path
QString plugin_root_path;
# if defined(Q_OS_MACOS)
plugin_root_path = QDir::cleanPath(app_path + QStringLiteral("/../PlugIns"));
plugin_root_path = QDir::cleanPath(app_path + QLatin1String("/../PlugIns"));
# elif defined(Q_OS_UNIX)
plugin_root_path = QDir::cleanPath(app_path + QStringLiteral("/../plugins"));
plugin_root_path = QDir::cleanPath(app_path + QLatin1String("/../plugins"));
# elif defined(Q_OS_WIN32)
plugin_root_path = app_path;
# endif
// Set GIO module path
const QString gio_module_path = plugin_root_path + QStringLiteral("/gio-modules");
const QString gio_module_path = plugin_root_path + QLatin1String("/gio-modules");
// Set GStreamer plugin scanner path
QString gst_plugin_scanner;
# if defined(Q_OS_UNIX)
gst_plugin_scanner = plugin_root_path + QStringLiteral("/gst-plugin-scanner");
gst_plugin_scanner = plugin_root_path + QLatin1String("/gst-plugin-scanner");
# endif
// Set GStreamer plugin path
QString gst_plugin_path;
# if defined(Q_OS_WIN32)
gst_plugin_path = plugin_root_path + QStringLiteral("/gstreamer-plugins");
gst_plugin_path = plugin_root_path + QLatin1String("/gstreamer-plugins");
# else
gst_plugin_path = plugin_root_path + QStringLiteral("/gstreamer");
gst_plugin_path = plugin_root_path + QLatin1String("/gstreamer");
# endif
if (!gio_module_path.isEmpty()) {

View File

@@ -107,7 +107,7 @@ EngineDeviceList MacOsDeviceFinder::ListDevices() {
EngineDevice device;
device.value = id;
device.description = QString::fromUtf8(CFStringGetCStringPtr(*device_name, CFStringGetSystemEncoding()));
if (device.description.isEmpty()) device.description = QStringLiteral("Unknown device ") + device.value.toString();
if (device.description.isEmpty()) device.description = QLatin1String("Unknown device ") + device.value.toString();
device.iconname = device.GuessIconName();
device_list.append(device);
}

View File

@@ -49,7 +49,7 @@ EngineDeviceList MMDeviceFinder::ListDevices() {
EngineDeviceList devices;
EngineDevice default_device;
default_device.description = QStringLiteral("Default device");
default_device.description = QLatin1String("Default device");
default_device.iconname = default_device.GuessIconName();
devices.append(default_device);

View File

@@ -129,7 +129,7 @@ bool VLCEngine::Play(const quint64 offset_nanosec) {
if (!Initialized()) return false;
// Set audio output
if (!output_.isEmpty() && output_ != QStringLiteral("auto")) {
if (!output_.isEmpty() && output_ != QLatin1String("auto")) {
int result = libvlc_audio_output_set(player_, output_.toUtf8().constData());
if (result != 0) qLog(Error) << "Failed to set output to" << output_;
}
@@ -225,8 +225,8 @@ EngineBase::OutputDetailsList VLCEngine::GetOutputsList() const {
OutputDetailsList outputs;
OutputDetails output_auto;
output_auto.name = QStringLiteral("auto");
output_auto.description = QStringLiteral("Automatically detected");
output_auto.name = QLatin1String("auto");
output_auto.description = QLatin1String("Automatically detected");
outputs << output_auto;
libvlc_audio_output_t *audio_output_list = libvlc_audio_output_list_get(instance_);
@@ -234,12 +234,12 @@ EngineBase::OutputDetailsList VLCEngine::GetOutputsList() const {
OutputDetails output;
output.name = QString::fromUtf8(audio_output->psz_name);
output.description = QString::fromUtf8(audio_output->psz_description);
if (output.name == QStringLiteral("auto")) output.iconname = QStringLiteral("soundcard");
else if ((output.name == QStringLiteral("alsa"))||(output.name == QStringLiteral("oss"))) output.iconname = QStringLiteral("alsa");
else if (output.name== QStringLiteral("jack")) output.iconname = QStringLiteral("jack");
else if (output.name == QStringLiteral("pulse")) output.iconname = QStringLiteral("pulseaudio");
else if (output.name == QStringLiteral("afile")) output.iconname = QStringLiteral("document-new");
else output.iconname = QStringLiteral("soundcard");
if (output.name == QLatin1String("auto")) output.iconname = QLatin1String("soundcard");
else if ((output.name == QLatin1String("alsa"))||(output.name == QLatin1String("oss"))) output.iconname = QLatin1String("alsa");
else if (output.name== QLatin1String("jack")) output.iconname = QLatin1String("jack");
else if (output.name == QLatin1String("pulse")) output.iconname = QLatin1String("pulseaudio");
else if (output.name == QLatin1String("afile")) output.iconname = QLatin1String("document-new");
else output.iconname = QLatin1String("soundcard");
outputs << output;
}
libvlc_audio_output_list_release(audio_output_list);
@@ -256,11 +256,11 @@ bool VLCEngine::ValidOutput(const QString &output) {
}
bool VLCEngine::CustomDeviceSupport(const QString &output) {
return (output != QStringLiteral("auto"));
return (output != QLatin1String("auto"));
}
bool VLCEngine::ALSADeviceSupport(const QString &output) {
return (output == QStringLiteral("alsa"));
return (output == QLatin1String("alsa"));
}
bool VLCEngine::ExclusiveModeSupport(const QString &output) {

View File

@@ -110,7 +110,7 @@ bool GlobalShortcutGrabber::event(QEvent *e) {
}
void GlobalShortcutGrabber::UpdateText() {
ui_->label_key->setText(QStringLiteral("<b>") + ret_.toString(QKeySequence::NativeText) + QStringLiteral("</b>"));
ui_->label_key->setText(QLatin1String("<b>") + ret_.toString(QKeySequence::NativeText) + QLatin1String("</b>"));
}
void GlobalShortcutGrabber::Accepted() {

View File

@@ -118,9 +118,9 @@ void GlobalShortcutsBackendGnome::DoUnregister() {
void GlobalShortcutsBackendGnome::GnomeMediaKeyPressed(const QString&, const QString &key) {
auto shortcuts = manager_->shortcuts();
if (key == QStringLiteral("Play")) shortcuts[QStringLiteral("play_pause")].action->trigger();
if (key == QStringLiteral("Stop")) shortcuts[QStringLiteral("stop")].action->trigger();
if (key == QStringLiteral("Next")) shortcuts[QStringLiteral("next_track")].action->trigger();
if (key == QStringLiteral("Previous")) shortcuts[QStringLiteral("prev_track")].action->trigger();
if (key == QLatin1String("Play")) shortcuts[QStringLiteral("play_pause")].action->trigger();
if (key == QLatin1String("Stop")) shortcuts[QStringLiteral("stop")].action->trigger();
if (key == QLatin1String("Next")) shortcuts[QStringLiteral("next_track")].action->trigger();
if (key == QLatin1String("Previous")) shortcuts[QStringLiteral("prev_track")].action->trigger();
}

View File

@@ -118,9 +118,9 @@ void GlobalShortcutsBackendMate::DoUnregister() {
void GlobalShortcutsBackendMate::MateMediaKeyPressed(const QString&, const QString &key) {
auto shortcuts = manager_->shortcuts();
if (key == QStringLiteral("Play")) shortcuts[QStringLiteral("play_pause")].action->trigger();
if (key == QStringLiteral("Stop")) shortcuts[QStringLiteral("stop")].action->trigger();
if (key == QStringLiteral("Next")) shortcuts[QStringLiteral("next_track")].action->trigger();
if (key == QStringLiteral("Previous")) shortcuts[QStringLiteral("prev_track")].action->trigger();
if (key == QLatin1String("Play")) shortcuts[QStringLiteral("play_pause")].action->trigger();
if (key == QLatin1String("Stop")) shortcuts[QStringLiteral("stop")].action->trigger();
if (key == QLatin1String("Next")) shortcuts[QStringLiteral("next_track")].action->trigger();
if (key == QLatin1String("Previous")) shortcuts[QStringLiteral("prev_track")].action->trigger();
}

View File

@@ -45,7 +45,7 @@ bool GlobalShortcutsBackendX11::IsAvailable() const {
bool GlobalShortcutsBackendX11::IsX11Available() {
return QApplication::platformName() == QStringLiteral("xcb");
return QApplication::platformName() == QLatin1String("xcb");
}

View File

@@ -91,7 +91,7 @@ QStandardItem *InternetSearchModel::BuildContainers(const Song &s, QStandardItem
case CollectionModel::GroupBy::AlbumArtist:
if (s.is_compilation()) {
display_text = tr("Various artists");
sort_text = QStringLiteral("aaaaaa");
sort_text = QLatin1String("aaaaaa");
}
else {
display_text = CollectionModel::TextOrUnknown(s.effective_albumartist());
@@ -103,7 +103,7 @@ QStandardItem *InternetSearchModel::BuildContainers(const Song &s, QStandardItem
case CollectionModel::GroupBy::Artist:
if (s.is_compilation()) {
display_text = tr("Various artists");
sort_text = QStringLiteral("aaaaaa");
sort_text = QLatin1String("aaaaaa");
}
else {
display_text = CollectionModel::TextOrUnknown(s.artist());
@@ -250,8 +250,9 @@ QStandardItem *InternetSearchModel::BuildContainers(const Song &s, QStandardItem
return parent;
}
if (display_text.isEmpty()) display_text = QStringLiteral("Unknown");
if (sort_text.isEmpty()) sort_text = QStringLiteral("Unknown");
if (display_text.isEmpty() || sort_text.isEmpty()) {
display_text = QLatin1String("Unknown");
}
// Find a container for this level
key->group_[level] = display_text + unique_tag;

View File

@@ -165,16 +165,16 @@ InternetTabsView::InternetTabsView(Application *app, InternetServicePtr service,
QString tab = s.value("tab", QStringLiteral("artists")).toString().toLower();
s.endGroup();
if (tab == QStringLiteral("artists")) {
if (tab == QLatin1String("artists")) {
ui_->tabs->setCurrentWidget(ui_->artists);
}
else if (tab == QStringLiteral("albums")) {
else if (tab == QLatin1String("albums")) {
ui_->tabs->setCurrentWidget(ui_->albums);
}
else if (tab == QStringLiteral("songs")) {
else if (tab == QLatin1String("songs")) {
ui_->tabs->setCurrentWidget(ui_->songs);
}
else if (tab == QStringLiteral("search")) {
else if (tab == QLatin1String("search")) {
ui_->tabs->setCurrentWidget(ui_->search);
}

View File

@@ -86,7 +86,7 @@ void LocalRedirectServer::incomingConnection(qintptr socket_descriptor) {
if (!tcp_socket->setSocketDescriptor(socket_descriptor)) {
delete tcp_socket;
close();
error_ = QStringLiteral("Unable to set socket descriptor");
error_ = QLatin1String("Unable to set socket descriptor");
emit Finished();
return;
}

View File

@@ -221,11 +221,11 @@ int main(int argc, char *argv[]) {
s.beginGroup(AppearanceSettingsPage::kSettingsGroup);
QString style = s.value(AppearanceSettingsPage::kStyle).toString();
if (style.isEmpty()) {
style=QStringLiteral("default");
style = QLatin1String("default");
s.setValue(AppearanceSettingsPage::kStyle, style);
}
s.endGroup();
if (style != QStringLiteral("default")) {
if (style != QLatin1String("default")) {
QApplication::setStyle(style);
}
if (QApplication::style()) qLog(Debug) << "Style:" << QApplication::style()->objectName();

View File

@@ -71,7 +71,7 @@ GstElement *MoodbarPipeline::CreateElement(const QString &factory_name) {
QByteArray MoodbarPipeline::ToGstUrl(const QUrl &url) {
if (url.isLocalFile() && !url.host().isEmpty()) {
QString str = QStringLiteral("file:////") + url.host() + url.path();
QString str = QLatin1String("file:////") + url.host() + url.path();
return str.toUtf8();
}

View File

@@ -325,7 +325,7 @@ bool MusicBrainzClient::MediumHasDiscid(const QString &discid, QXmlStreamReader
QXmlStreamReader::TokenType type = reader->readNext();
QString name = reader->name().toString();
if (type == QXmlStreamReader::StartElement && name == QLatin1String("disc") && reader->attributes().value(QStringLiteral("id")).toString() == discid) {
if (type == QXmlStreamReader::StartElement && name == QLatin1String("disc") && reader->attributes().value(QLatin1String("id")).toString() == discid) {
return true;
}
if (type == QXmlStreamReader::EndElement && name == QLatin1String("disc-list")) {
@@ -442,7 +442,7 @@ void MusicBrainzClient::ParseArtist(QXmlStreamReader *reader, QString *artist) {
QXmlStreamReader::TokenType type = reader->readNext();
QString name = reader->name().toString();
if (type == QXmlStreamReader::StartElement && name == QLatin1String("name-credit")) {
join_phrase = reader->attributes().value(QStringLiteral("joinphrase")).toString();
join_phrase = reader->attributes().value(QLatin1String("joinphrase")).toString();
}
if (type == QXmlStreamReader::StartElement && name == QLatin1String("name")) {
@@ -478,7 +478,7 @@ MusicBrainzClient::Release MusicBrainzClient::ParseRelease(QXmlStreamReader *rea
}
}
else if (name == QLatin1String("track-list")) {
ret.track_ = reader->attributes().value(QStringLiteral("offset")).toString().toInt() + 1;
ret.track_ = reader->attributes().value(QLatin1String("offset")).toString().toInt() + 1;
Utilities::ConsumeCurrentElement(reader);
}
}

View File

@@ -248,7 +248,7 @@ void OSDPretty::Load() {
fading_enabled_ = s.value("fading", false).toBool();
#endif
if (s.contains(QStringLiteral("popup_screen"))) {
if (s.contains(QLatin1String("popup_screen"))) {
popup_screen_name_ = s.value("popup_screen").toString();
if (screens_.contains(popup_screen_name_)) {
popup_screen_ = screens_[popup_screen_name_];
@@ -264,7 +264,7 @@ void OSDPretty::Load() {
if (current_screen()) popup_screen_name_ = current_screen()->name();
}
if (s.contains(QStringLiteral("popup_pos"))) {
if (s.contains(QLatin1String("popup_pos"))) {
popup_pos_ = s.value("popup_pos").toPoint();
}
else {

View File

@@ -126,33 +126,33 @@ PlaylistContainer::PlaylistContainer(QWidget *parent)
QString available_fields = PlaylistFilter().column_names().keys().join(QLatin1String(", "));
ui_->search_field->setToolTip(
QStringLiteral("<html><head/><body><p>") +
QLatin1String("<html><head/><body><p>") +
tr("Prefix a search term with a field name to limit the search to that field, e.g.:") +
QStringLiteral(" ") +
QStringLiteral("<span style=\"font-weight:600;\">") +
QLatin1Char(' ') +
QLatin1String("<span style=\"font-weight:600;\">") +
tr("artist") +
QStringLiteral(":</span><span style=\"font-style:italic;\">Strawbs</span> ") +
tr("searches the playlist for all artists that contain the word %1. ").arg(QStringLiteral("Strawbs")) +
QStringLiteral("</p><p>") +
QLatin1String(":</span><span style=\"font-style:italic;\">Strawbs</span> ") +
tr("searches the playlist for all artists that contain the word %1. ").arg(QLatin1String("Strawbs")) +
QLatin1String("</p><p>") +
tr("Search terms for numerical fields can be prefixed with %1 or %2 to refine the search, e.g.: ")
.arg(QLatin1String(" =, !=, &lt;, &gt;, &lt;="), QStringLiteral("&gt;=")) +
QStringLiteral("<span style=\"font-weight:600;\">") +
.arg(QLatin1String(" =, !=, &lt;, &gt;, &lt;="), QLatin1String("&gt;=")) +
QLatin1String("<span style=\"font-weight:600;\">") +
tr("rating") +
QStringLiteral("</span>") +
QStringLiteral(":>=") +
QStringLiteral("<span style=\"font-weight:italic;\">4</span>") +
QStringLiteral("</p><p>") +
QLatin1String("</span>") +
QLatin1String(":>=") +
QLatin1String("<span style=\"font-weight:italic;\">4</span>") +
QLatin1String("</p><p>") +
tr("Multiple search terms can also be combined with \"%1\" (default) and \"%2\", as well as grouped with parentheses. ")
.arg(QLatin1String("AND"), QLatin1String("OR")) +
QStringLiteral("</p><p><span style=\"font-weight:600;\">") +
QLatin1String("</p><p><span style=\"font-weight:600;\">") +
tr("Available fields") +
QStringLiteral(": ") + QStringLiteral("</span><span style=\"font-style:italic;\">") +
QLatin1String(": ") + QLatin1String("</span><span style=\"font-style:italic;\">") +
available_fields +
QStringLiteral("</span>.") +
QStringLiteral("</p></body></html>")
QLatin1String("</span>.") +
QLatin1String("</p></body></html>")
);

View File

@@ -488,7 +488,7 @@ FilterTree *FilterParser::parseSearchTerm() {
if (prefix.isEmpty() && (*iter_ == QLatin1Char('>') || *iter_ == QLatin1Char('<') || *iter_ == QLatin1Char('=') || *iter_ == QLatin1Char('!'))) {
prefix += *iter_;
}
else if (prefix != QLatin1String("=") && *iter_ == QLatin1Char('=')) {
else if (prefix != QLatin1Char('=') && *iter_ == QLatin1Char('=')) {
prefix += *iter_;
}
else {
@@ -510,7 +510,7 @@ FilterTree *FilterParser::parseSearchTerm() {
FilterTree *FilterParser::createSearchTermTreeNode(const QString &col, const QString &prefix, const QString &search) const {
if (search.isEmpty() && prefix != QLatin1String("=")) {
if (search.isEmpty() && prefix != QLatin1Char('=')) {
return new NopFilter;
}
// here comes a mess :/
@@ -521,29 +521,29 @@ FilterTree *FilterParser::createSearchTermTreeNode(const QString &col, const QSt
if (columns_[col] == Playlist::Column_Rating) {
float parsed_search = Utilities::ParseSearchRating(search);
if (prefix == QStringLiteral("=")) {
if (prefix == QLatin1Char('=')) {
cmp = new FloatEqComparator(parsed_search);
}
else if (prefix == QStringLiteral("!=") || prefix == QStringLiteral("<>")) {
else if (prefix == QLatin1String("!=") || prefix == QLatin1String("<>")) {
cmp = new FloatNeComparator(parsed_search);
}
else if (prefix == QStringLiteral(">")) {
else if (prefix == QLatin1Char('>')) {
cmp = new FloatGtComparator(parsed_search);
}
else if (prefix == QStringLiteral(">=")) {
else if (prefix == QLatin1String(">=")) {
cmp = new FloatGeComparator(parsed_search);
}
else if (prefix == QStringLiteral("<")) {
else if (prefix == QLatin1Char('<')) {
cmp = new FloatLtComparator(parsed_search);
}
else if (prefix == QStringLiteral("<=")) {
else if (prefix == QLatin1String("<=")) {
cmp = new FloatLeComparator(parsed_search);
}
else {
cmp = new FloatEqComparator(parsed_search);
}
}
else if (prefix == QStringLiteral("!=") || prefix == QStringLiteral("<>")) {
else if (prefix == QLatin1String("!=") || prefix == QLatin1String("<>")) {
cmp = new NeComparator(search);
}
else if (!col.isEmpty() && columns_.contains(col) && numerical_columns_.contains(columns_[col])) {
@@ -556,13 +556,13 @@ FilterTree *FilterParser::createSearchTermTreeNode(const QString &col, const QSt
search_value = search.toInt();
}
// alright, back to deciding which comparator we'll use
if (prefix == QLatin1String(">")) {
if (prefix == QLatin1Char('>')) {
cmp = new GtComparator(search_value);
}
else if (prefix == QLatin1String(">=")) {
cmp = new GeComparator(search_value);
}
else if (prefix == QLatin1String("<")) {
else if (prefix == QLatin1Char('<')) {
cmp = new LtComparator(search_value);
}
else if (prefix == QLatin1String("<=")) {
@@ -574,19 +574,19 @@ FilterTree *FilterParser::createSearchTermTreeNode(const QString &col, const QSt
}
}
else {
if (prefix == QStringLiteral("=")) {
if (prefix == QLatin1Char('=')) {
cmp = new EqComparator(search);
}
else if (prefix == QStringLiteral(">")) {
else if (prefix == QLatin1Char('>')) {
cmp = new LexicalGtComparator(search);
}
else if (prefix == QStringLiteral(">=")) {
else if (prefix == QLatin1String(">=")) {
cmp = new LexicalGeComparator(search);
}
else if (prefix == QStringLiteral("<")) {
else if (prefix == QLatin1Char('<')) {
cmp = new LexicalLtComparator(search);
}
else if (prefix == QStringLiteral("<=")) {
else if (prefix == QLatin1String("<=")) {
cmp = new LexicalLeComparator(search);
}
else {

View File

@@ -250,7 +250,7 @@ void PlaylistManager::SaveWithUI(const int id, const QString &playlist_name) {
s.endGroup();
QString suggested_filename = playlist_name;
QString filename = last_save_path + QLatin1Char('/') + suggested_filename.remove(QRegularExpression(QLatin1String(kProblematicCharactersRegex), QRegularExpression::CaseInsensitiveOption)) + QStringLiteral(".") + last_save_extension;
QString filename = last_save_path + QLatin1Char('/') + suggested_filename.remove(QRegularExpression(QLatin1String(kProblematicCharactersRegex), QRegularExpression::CaseInsensitiveOption)) + QLatin1Char('.') + last_save_extension;
QFileInfo fileinfo;
forever {
@@ -451,7 +451,7 @@ void PlaylistManager::UpdateSummaryText() {
summary += tr("%n track(s)", "", tracks);
if (nanoseconds > 0) {
summary += QStringLiteral(" - [ ") + Utilities::WordyTimeNanosec(nanoseconds) + QStringLiteral(" ]");
summary += QLatin1String(" - [ ") + Utilities::WordyTimeNanosec(nanoseconds) + QLatin1String(" ]");
}
emit SummaryTextChanged(summary);
@@ -566,7 +566,7 @@ QString PlaylistManager::GetNameForNewPlaylist(const SongList &songs) {
if (!various_artists && albums.size() == 1) {
QStringList album_names = albums.values();
result += QStringLiteral(" - ") + album_names.first();
result += QLatin1String(" - ") + album_names.first();
}
return result;

View File

@@ -93,20 +93,20 @@ Song ASXParser::ParseTrack(QXmlStreamReader *reader, const QDir &dir, const bool
switch (type) {
case QXmlStreamReader::StartElement:{
const QString name = reader->name().toString().toLower();
if (name == QStringLiteral("ref")) {
ref = reader->attributes().value(QStringLiteral("href")).toString();
if (name == QLatin1String("ref")) {
ref = reader->attributes().value(QLatin1String("href")).toString();
}
else if (name == QStringLiteral("title")) {
else if (name == QLatin1String("title")) {
title = reader->readElementText();
}
else if (name == QStringLiteral("author")) {
else if (name == QLatin1String("author")) {
artist = reader->readElementText();
}
break;
}
case QXmlStreamReader::EndElement:{
const QString name = reader->name().toString().toLower();
if (name == QStringLiteral("entry")) {
if (name == QLatin1String("entry")) {
goto return_song;
}
break;
@@ -138,16 +138,16 @@ void ASXParser::Save(const SongList &songs, QIODevice *device, const QDir&, cons
writer.writeStartDocument();
{
StreamElement asx(QStringLiteral("asx"), &writer);
writer.writeAttribute(QStringLiteral("version"), QStringLiteral("3.0"));
writer.writeAttribute(QLatin1String("version"), QLatin1String("3.0"));
for (const Song &song : songs) {
StreamElement entry(QStringLiteral("entry"), &writer);
writer.writeTextElement(QStringLiteral("title"), song.title());
writer.writeTextElement(QLatin1String("title"), song.title());
{
StreamElement ref(QStringLiteral("ref"), &writer);
writer.writeAttribute(QStringLiteral("href"), song.url().toString());
writer.writeAttribute(QLatin1String("href"), song.url().toString());
}
if (!song.artist().isEmpty()) {
writer.writeTextElement(QStringLiteral("author"), song.artist());
writer.writeTextElement(QLatin1String("author"), song.artist());
}
}
}

View File

@@ -69,8 +69,8 @@ void WplParser::ParseSeq(const QDir &dir, QXmlStreamReader *reader, SongList *so
QString name = reader->name().toString();
switch (type) {
case QXmlStreamReader::StartElement:{
if (name == QStringLiteral("media")) {
QString src = reader->attributes().value(QStringLiteral("src")).toString();
if (name == QLatin1String("media")) {
QString src = reader->attributes().value(QLatin1String("src")).toString();
if (!src.isEmpty()) {
Song song = LoadSong(src, 0, 0, dir, collection_search);
if (song.is_valid()) {
@@ -84,7 +84,7 @@ void WplParser::ParseSeq(const QDir &dir, QXmlStreamReader *reader, SongList *so
break;
}
case QXmlStreamReader::EndElement:{
if (name == QStringLiteral("seq")) {
if (name == QLatin1String("seq")) {
return;
}
break;
@@ -101,14 +101,14 @@ void WplParser::Save(const SongList &songs, QIODevice *device, const QDir &dir,
QXmlStreamWriter writer(device);
writer.setAutoFormatting(true);
writer.setAutoFormattingIndent(2);
writer.writeProcessingInstruction(QStringLiteral("wpl"), QStringLiteral("version=\"1.0\""));
writer.writeProcessingInstruction(QLatin1String("wpl"), QLatin1String("version=\"1.0\""));
StreamElement smil(QStringLiteral("smil"), &writer);
{
StreamElement head(QStringLiteral("head"), &writer);
WriteMeta(QStringLiteral("Generator"), QStringLiteral("Strawberry -- ") + QLatin1String(STRAWBERRY_VERSION_DISPLAY), &writer);
WriteMeta(QStringLiteral("ItemCount"), QString::number(songs.count()), &writer);
WriteMeta(QLatin1String("Generator"), QLatin1String("Strawberry -- ") + QLatin1String(STRAWBERRY_VERSION_DISPLAY), &writer);
WriteMeta(QLatin1String("ItemCount"), QString::number(songs.count()), &writer);
}
{
@@ -116,8 +116,8 @@ void WplParser::Save(const SongList &songs, QIODevice *device, const QDir &dir,
{
StreamElement seq(QStringLiteral("seq"), &writer);
for (const Song &song : songs) {
writer.writeStartElement(QStringLiteral("media"));
writer.writeAttribute(QStringLiteral("src"), URLOrFilename(song.url(), dir, path_type));
writer.writeStartElement(QLatin1String("media"));
writer.writeAttribute(QLatin1String("src"), URLOrFilename(song.url(), dir, path_type));
writer.writeEndElement();
}
}
@@ -126,9 +126,9 @@ void WplParser::Save(const SongList &songs, QIODevice *device, const QDir &dir,
void WplParser::WriteMeta(const QString &name, const QString &content, QXmlStreamWriter *writer) {
writer->writeStartElement(QStringLiteral("meta"));
writer->writeAttribute(QStringLiteral("name"), name);
writer->writeAttribute(QStringLiteral("content"), content);
writer->writeStartElement(QLatin1String("meta"));
writer->writeAttribute(QLatin1String("name"), name);
writer->writeAttribute(QLatin1String("content"), content);
writer->writeEndElement();
}

View File

@@ -74,22 +74,22 @@ Song XSPFParser::ParseTrack(QXmlStreamReader *reader, const QDir &dir, const boo
QString name = reader->name().toString();
switch (type) {
case QXmlStreamReader::StartElement:{
if (name == QStringLiteral("location")) {
if (name == QLatin1String("location")) {
location = QUrl::fromPercentEncoding(reader->readElementText().toUtf8());
}
else if (name == QStringLiteral("title")) {
else if (name == QLatin1String("title")) {
title = reader->readElementText();
}
else if (name == QStringLiteral("creator")) {
else if (name == QLatin1String("creator")) {
artist = reader->readElementText();
}
else if (name == QStringLiteral("album")) {
else if (name == QLatin1String("album")) {
album = reader->readElementText();
}
else if (name == QStringLiteral("image")) {
else if (name == QLatin1String("image")) {
art = QUrl::fromPercentEncoding(reader->readElementText().toUtf8());
}
else if (name == QStringLiteral("duration")) { // in milliseconds.
else if (name == QLatin1String("duration")) { // in milliseconds.
const QString duration = reader->readElementText();
bool ok = false;
nanosec = duration.toInt(&ok) * kNsecPerMsec;
@@ -97,7 +97,7 @@ Song XSPFParser::ParseTrack(QXmlStreamReader *reader, const QDir &dir, const boo
nanosec = -1;
}
}
else if (name == QStringLiteral("trackNum")) {
else if (name == QLatin1String("trackNum")) {
const QString track_num_str = reader->readElementText();
bool ok = false;
track_num = track_num_str.toInt(&ok);
@@ -105,13 +105,13 @@ Song XSPFParser::ParseTrack(QXmlStreamReader *reader, const QDir &dir, const boo
track_num = -1;
}
}
else if (name == QStringLiteral("info")) {
else if (name == QLatin1String("info")) {
// TODO: Do something with extra info?
}
break;
}
case QXmlStreamReader::EndElement:{
if (name == QStringLiteral("track")) {
if (name == QLatin1String("track")) {
goto return_song;
}
}
@@ -144,8 +144,8 @@ void XSPFParser::Save(const SongList &songs, QIODevice *device, const QDir &dir,
writer.setAutoFormattingIndent(2);
writer.writeStartDocument();
StreamElement playlist(QStringLiteral("playlist"), &writer);
writer.writeAttribute(QStringLiteral("version"), QStringLiteral("1"));
writer.writeDefaultNamespace(QStringLiteral("http://xspf.org/ns/0/"));
writer.writeAttribute(QLatin1String("version"), QLatin1String("1"));
writer.writeDefaultNamespace(QLatin1String("http://xspf.org/ns/0/"));
Settings s;
s.beginGroup(PlaylistSettingsPage::kSettingsGroup);
@@ -157,23 +157,23 @@ void XSPFParser::Save(const SongList &songs, QIODevice *device, const QDir &dir,
QString filename_or_url = QString::fromLatin1(QUrl::toPercentEncoding(URLOrFilename(song.url(), dir, path_type), "/ "));
StreamElement track(QStringLiteral("track"), &writer);
writer.writeTextElement(QStringLiteral("location"), filename_or_url);
writer.writeTextElement(QLatin1String("location"), filename_or_url);
if (write_metadata || (song.is_stream() && !song.is_radio())) {
writer.writeTextElement(QStringLiteral("title"), song.title());
writer.writeTextElement(QLatin1String("title"), song.title());
if (!song.artist().isEmpty()) {
writer.writeTextElement(QStringLiteral("creator"), song.artist());
writer.writeTextElement(QLatin1String("creator"), song.artist());
}
if (!song.album().isEmpty()) {
writer.writeTextElement(QStringLiteral("album"), song.album());
writer.writeTextElement(QLatin1String("album"), song.album());
}
if (song.length_nanosec() != -1) {
writer.writeTextElement(QStringLiteral("duration"), QString::number(song.length_nanosec() / kNsecPerMsec));
writer.writeTextElement(QLatin1String("duration"), QString::number(song.length_nanosec() / kNsecPerMsec));
}
}
if ((write_metadata || song.has_cue() || (song.is_stream() && !song.is_radio())) && song.track() > 0) {
writer.writeTextElement(QStringLiteral("trackNum"), QString::number(song.track()));
writer.writeTextElement(QLatin1String("trackNum"), QString::number(song.track()));
}
if (write_metadata || (song.is_stream() && !song.is_radio())) {
@@ -181,7 +181,7 @@ void XSPFParser::Save(const SongList &songs, QIODevice *device, const QDir &dir,
// Ignore images that are in our resource bundle.
if (!cover_url.isEmpty() && cover_url.isValid()) {
const QString cover_filename = QString::fromLatin1(QUrl::toPercentEncoding(URLOrFilename(cover_url, dir, path_type), "/ "));
writer.writeTextElement(QStringLiteral("image"), cover_filename);
writer.writeTextElement(QLatin1String("image"), cover_filename);
}
}
}

View File

@@ -121,7 +121,7 @@ void QobuzStreamURLRequest::GetStreamURL() {
std::sort(params_to_sign.begin(), params_to_sign.end());
QString data_to_sign;
data_to_sign += QStringLiteral("trackgetFileUrl");
data_to_sign += QLatin1String("trackgetFileUrl");
for (const Param &param : params_to_sign) {
data_to_sign += param.first + param.second;
}

View File

@@ -255,7 +255,7 @@ void Queue::UpdateSummaryText() {
summary += tr("%n track(s)", "", tracks);
if (nanoseconds > 0) {
summary += QStringLiteral(" - [ ") + Utilities::WordyTimeNanosec(nanoseconds) + QStringLiteral(" ]");
summary += QLatin1String(" - [ ") + Utilities::WordyTimeNanosec(nanoseconds) + QLatin1String(" ]");
}
emit SummaryTextChanged(summary);

View File

@@ -177,7 +177,7 @@ void RadioModel::AddChannels(const RadioChannelList &channels) {
RadioItem *item = new RadioItem(RadioItem::Type::Channel, container);
item->source = channel.source;
item->display_text = channel.name;
item->sort_text = SortText(Song::TextForSource(channel.source) + QStringLiteral(" - ") + channel.name);
item->sort_text = SortText(Song::TextForSource(channel.source) + QLatin1String(" - ") + channel.name);
item->channel = channel;
items_ << item;
endInsertRows();
@@ -325,7 +325,7 @@ void RadioModel::AlbumCoverLoaded(const quint64 id, const AlbumCoverLoaderResult
QString RadioModel::SortText(QString text) {
if (text.isEmpty()) {
text = QStringLiteral(" unknown");
text = QLatin1String(" unknown");
}
else {
text = text.toLower();

View File

@@ -110,11 +110,11 @@ void RadioParadiseService::GetChannelsReply(QNetworkReply *reply, const int task
QString label = obj_stream[QLatin1String("label")].toString();
QString url = obj_stream[QLatin1String("url")].toString();
if (!url.contains(QRegularExpression(QStringLiteral("^[0-9a-zA-Z]*:\\/\\/"), QRegularExpression::CaseInsensitiveOption))) {
url.prepend(QStringLiteral("https://"));
url.prepend(QLatin1String("https://"));
}
RadioChannel channel;
channel.source = source_;
channel.name = name + QStringLiteral(" - ") + label;
channel.name = name + QLatin1String(" - ") + label;
channel.url.setUrl(url);
channels << channel;
}

View File

@@ -112,7 +112,7 @@ void SomaFMService::GetChannelsReply(QNetworkReply *reply, const int task_id) {
}
RadioChannel channel;
QString quality = obj_playlist[QLatin1String("quality")].toString();
if (quality != QStringLiteral("highest")) continue;
if (quality != QLatin1String("highest")) continue;
channel.source = source_;
channel.name = name;
channel.url.setUrl(obj_playlist[QLatin1String("url")].toString());

View File

@@ -260,7 +260,7 @@ void GlobalShortcutsSettingsPage::OpenGnomeKeybindingProperties() {
if (!QProcess::startDetached(QStringLiteral("gnome-keybinding-properties"), QStringList())) {
if (!QProcess::startDetached(QStringLiteral("gnome-control-center"), QStringList() << QStringLiteral("keyboard"))) {
QMessageBox::warning(this, QStringLiteral("Error"), tr("The \"%1\" command could not be started.").arg(QStringLiteral("gnome-keybinding-properties")));
QMessageBox::warning(this, QStringLiteral("Error"), tr("The \"%1\" command could not be started.").arg(QLatin1String("gnome-keybinding-properties")));
}
}
@@ -270,7 +270,7 @@ void GlobalShortcutsSettingsPage::OpenMateKeybindingProperties() {
if (!QProcess::startDetached(QStringLiteral("mate-keybinding-properties"), QStringList())) {
if (!QProcess::startDetached(QStringLiteral("mate-control-center"), QStringList() << QStringLiteral("keyboard"))) {
QMessageBox::warning(this, QStringLiteral("Error"), tr("The \"%1\" command could not be started.").arg(QStringLiteral("mate-keybinding-properties")));
QMessageBox::warning(this, QStringLiteral("Error"), tr("The \"%1\" command could not be started.").arg(QLatin1String("mate-keybinding-properties")));
}
}
@@ -345,18 +345,18 @@ void GlobalShortcutsSettingsPage::ChangeClicked() {
void GlobalShortcutsSettingsPage::X11Warning() {
QString de = de_.toLower();
if (de == QStringLiteral("kde") || de == QStringLiteral("gnome") || de == QStringLiteral("x-cinnamon") || de == QStringLiteral("mate")) {
if (de == QLatin1String("kde") || de == QLatin1String("gnome") || de == QLatin1String("x-cinnamon") || de == QLatin1String("mate")) {
QString text(tr("Using X11 shortcuts on %1 is not recommended and can cause keyboard to become unresponsive!").arg(de_));
if (de == QStringLiteral("kde")) {
if (de == QLatin1String("kde")) {
text += tr(" Shortcuts on %1 are usually used through MPRIS and KGlobalAccel.").arg(de_);
}
else if (de == QStringLiteral("gnome")) {
else if (de == QLatin1String("gnome")) {
text += tr(" Shortcuts on %1 are usually used through Gnome Settings Daemon and should be configured in gnome-settings-daemon instead.").arg(de_);
}
else if (de == QStringLiteral("x-cinnamon")) {
else if (de == QLatin1String("x-cinnamon")) {
text += tr(" Shortcuts on %1 are usually used through Gnome Settings Daemon and should be configured in cinnamon-settings-daemon instead.").arg(de_);
}
else if (de == QStringLiteral("mate")) {
else if (de == QLatin1String("mate")) {
text += tr(" Shortcuts on %1 are usually used through MATE Settings Daemon and should be configured there instead.").arg(de_);
}
ui_->label_warn_text->setText(text);

View File

@@ -62,7 +62,7 @@ QString SmartPlaylistSearch::ToSql(const QString &songs_table) const {
}
if (!terms_.isEmpty() && search_type_ != SearchType::All) {
QString boolean_op = search_type_ == SearchType::And ? QStringLiteral(" AND ") : QStringLiteral(" OR ");
QString boolean_op = search_type_ == SearchType::And ? QLatin1String(" AND ") : QLatin1String(" OR ");
where_clauses << QStringLiteral("(") + term_where_clauses.join(boolean_op) + QStringLiteral(")");
}
@@ -80,7 +80,7 @@ QString SmartPlaylistSearch::ToSql(const QString &songs_table) const {
where_clauses << QStringLiteral("unavailable = 0");
if (!where_clauses.isEmpty()) {
sql += QStringLiteral(" WHERE ") + where_clauses.join(QLatin1String(" AND "));
sql += QLatin1String(" WHERE ") + where_clauses.join(QLatin1String(" AND "));
}
// Add sort by
@@ -88,7 +88,7 @@ QString SmartPlaylistSearch::ToSql(const QString &songs_table) const {
sql += QLatin1String(" ORDER BY random()");
}
else {
sql += QStringLiteral(" ORDER BY ") + SmartPlaylistSearchTerm::FieldColumnName(sort_field_) + (sort_type_ == SortType::FieldAsc ? QStringLiteral(" ASC") : QStringLiteral(" DESC"));
sql += QLatin1String(" ORDER BY ") + SmartPlaylistSearchTerm::FieldColumnName(sort_field_) + (sort_type_ == SortType::FieldAsc ? QLatin1String(" ASC") : QLatin1String(" DESC"));
}
// Add limit
@@ -96,7 +96,7 @@ QString SmartPlaylistSearch::ToSql(const QString &songs_table) const {
sql += QStringLiteral(" LIMIT %1 OFFSET %2").arg(limit_).arg(first_item_);
}
else if (limit_ != -1) {
sql += QStringLiteral(" LIMIT ") + QString::number(limit_);
sql += QLatin1String(" LIMIT ") + QString::number(limit_);
}
//qLog(Debug) << sql;

View File

@@ -62,12 +62,12 @@ QString SmartPlaylistSearchTerm::ToSql() const {
if (TypeOf(field_) == Type::Date) {
if (special_date_query) {
// We have a numeric date, consider also the time for more precision
col = QStringLiteral("DATETIME(") + col + QStringLiteral(", 'unixepoch', 'localtime')");
col = QLatin1String("DATETIME(") + col + QLatin1String(", 'unixepoch', 'localtime')");
second_value = second_value_.toString();
second_value.replace(QLatin1Char('\''), QLatin1String("''"));
if (date == QStringLiteral("weeks")) {
if (date == QLatin1String("weeks")) {
// Sqlite doesn't know weeks, transform them to days
date = QStringLiteral("days");
date = QLatin1String("days");
value = QString::number(value_.toInt() * 7);
second_value = QString::number(second_value_.toInt() * 7);
}
@@ -76,13 +76,13 @@ QString SmartPlaylistSearchTerm::ToSql() const {
// We have the exact date
// The calendar widget specifies no time so ditch the possible time part
// from integers representing the dates.
col = QStringLiteral("DATE(") + col + QStringLiteral(", 'unixepoch', 'localtime')");
value = QStringLiteral("DATE(") + value + QStringLiteral(", 'unixepoch', 'localtime')");
col = QLatin1String("DATE(") + col + QLatin1String(", 'unixepoch', 'localtime')");
value = QLatin1String("DATE(") + value + QLatin1String(", 'unixepoch', 'localtime')");
}
}
else if (TypeOf(field_) == Type::Time) {
// Convert seconds to nanoseconds
value = QStringLiteral("CAST (") + value + QStringLiteral(" *1000000000 AS INTEGER)");
value = QLatin1String("CAST (") + value + QLatin1String(" *1000000000 AS INTEGER)");
}
// File paths need some extra processing since they are stored as encoded urls in the database.
@@ -95,61 +95,61 @@ QString SmartPlaylistSearchTerm::ToSql() const {
}
}
else if (TypeOf(field_) == Type::Rating) {
col = QStringLiteral("CAST ((replace(") + col + QStringLiteral(", -1, 0) + 0.05) * 10 AS INTEGER)");
value = QStringLiteral("CAST ((") + value + QStringLiteral(" + 0.05) * 10 AS INTEGER)");
col = QLatin1String("CAST ((replace(") + col + QLatin1String(", -1, 0) + 0.05) * 10 AS INTEGER)");
value = QLatin1String("CAST ((") + value + QLatin1String(" + 0.05) * 10 AS INTEGER)");
}
switch (operator_) {
case Operator::Contains:
return col + QStringLiteral(" LIKE '%") + value + QStringLiteral("%'");
return col + QLatin1String(" LIKE '%") + value + QLatin1String("%'");
case Operator::NotContains:
return col + QStringLiteral(" NOT LIKE '%") + value + QStringLiteral("%'");
return col + QLatin1String(" NOT LIKE '%") + value + QLatin1String("%'");
case Operator::StartsWith:
return col + QStringLiteral(" LIKE '") + value + QStringLiteral("%'");
return col + QLatin1String(" LIKE '") + value + QLatin1String("%'");
case Operator::EndsWith:
return col + QStringLiteral(" LIKE '%") + value + QLatin1Char('\'');
return col + QLatin1String(" LIKE '%") + value + QLatin1Char('\'');
case Operator::Equals:
if (TypeOf(field_) == Type::Text) {
return col + QStringLiteral(" LIKE '") + value + QLatin1Char('\'');
return col + QLatin1String(" LIKE '") + value + QLatin1Char('\'');
}
else if (TypeOf(field_) == Type::Date || TypeOf(field_) == Type::Time || TypeOf(field_) == Type::Rating) {
return col + QStringLiteral(" = ") + value;
return col + QLatin1String(" = ") + value;
}
else {
return col + QStringLiteral(" = '") + value + QLatin1Char('\'');
return col + QLatin1String(" = '") + value + QLatin1Char('\'');
}
case Operator::GreaterThan:
if (TypeOf(field_) == Type::Date || TypeOf(field_) == Type::Time || TypeOf(field_) == Type::Rating) {
return col + QStringLiteral(" > ") + value;
return col + QLatin1String(" > ") + value;
}
else {
return col + QStringLiteral(" > '") + value + QLatin1Char('\'');
return col + QLatin1String(" > '") + value + QLatin1Char('\'');
}
case Operator::LessThan:
if (TypeOf(field_) == Type::Date || TypeOf(field_) == Type::Time || TypeOf(field_) == Type::Rating) {
return col + QStringLiteral(" < ") + value;
return col + QLatin1String(" < ") + value;
}
else {
return col + QStringLiteral(" < '") + value + QLatin1Char('\'');
return col + QLatin1String(" < '") + value + QLatin1Char('\'');
}
case Operator::NumericDate:
return col + QStringLiteral(" > ") + QStringLiteral("DATETIME('now', '-") + value + QLatin1Char(' ') + date + QStringLiteral("', 'localtime')");
return col + QLatin1String(" > ") + QLatin1String("DATETIME('now', '-") + value + QLatin1Char(' ') + date + QLatin1String("', 'localtime')");
case Operator::NumericDateNot:
return col + QStringLiteral(" < ") + QStringLiteral("DATETIME('now', '-") + value + QLatin1Char(' ') + date + QStringLiteral("', 'localtime')");
return col + QLatin1String(" < ") + QLatin1String("DATETIME('now', '-") + value + QLatin1Char(' ') + date + QLatin1String("', 'localtime')");
case Operator::RelativeDate:
// Consider the time range before the first date but after the second one
return QStringLiteral("(") + col + QStringLiteral(" < ") + QStringLiteral("DATETIME('now', '-") + value + QLatin1Char(' ') + date + QStringLiteral("', 'localtime') AND ") + col + QStringLiteral(" > ") + QStringLiteral("DATETIME('now', '-") + second_value + QLatin1Char(' ') + date + QStringLiteral("', 'localtime'))");
return QLatin1String("(") + col + QLatin1String(" < ") + QLatin1String("DATETIME('now', '-") + value + QLatin1Char(' ') + date + QLatin1String("', 'localtime') AND ") + col + QLatin1String(" > ") + QLatin1String("DATETIME('now', '-") + second_value + QLatin1Char(' ') + date + QLatin1String("', 'localtime'))");
case Operator::NotEquals:
if (TypeOf(field_) == Type::Text) {
return col + QStringLiteral(" <> '") + value + QLatin1Char('\'');
return col + QLatin1String(" <> '") + value + QLatin1Char('\'');
}
else {
return col + QStringLiteral(" <> ") + value;
return col + QLatin1String(" <> ") + value;
}
case Operator::Empty:
return col + QStringLiteral(" = ''");
return col + QLatin1String(" = ''");
case Operator::NotEmpty:
return col + QStringLiteral(" <> ''");
return col + QLatin1String(" <> ''");
}
return QString();

View File

@@ -95,8 +95,8 @@ GstElement *Transcoder::CreateElementForMimeType(const QString &element_type, co
if (mime_type.isEmpty()) return nullptr;
// HACK: Force mp4mux because it doesn't set any useful src caps
if (mime_type == QStringLiteral("audio/mp4")) {
emit LogLine(QStringLiteral("Using '%1' (rank %2)").arg(QStringLiteral("mp4mux")).arg(-1));
if (mime_type == QLatin1String("audio/mp4")) {
emit LogLine(QStringLiteral("Using '%1' (rank %2)").arg(QLatin1String("mp4mux")).arg(-1));
return CreateElement(QStringLiteral("mp4mux"), bin);
}
@@ -153,7 +153,7 @@ GstElement *Transcoder::CreateElementForMimeType(const QString &element_type, co
emit LogLine(QStringLiteral("Using '%1' (rank %2)").arg(best.name_).arg(best.rank_));
if (best.name_ == QStringLiteral("lamemp3enc")) {
if (best.name_ == QLatin1String("lamemp3enc")) {
// Special case: we need to add xingmux and id3v2mux to the pipeline when using lamemp3enc because it doesn't write the VBR or ID3v2 headers itself.
emit LogLine(QStringLiteral("Adding xingmux and id3v2mux to the pipeline"));
@@ -214,7 +214,7 @@ Transcoder::Transcoder(QObject *parent, const QString &settings_postfix)
// Initialize some settings for the lamemp3enc element.
Settings s;
s.beginGroup(QStringLiteral("Transcoder/lamemp3enc") + settings_postfix_);
s.beginGroup(QLatin1String("Transcoder/lamemp3enc") + settings_postfix_);
if (s.value("target").isNull()) {
s.setValue("target", 1); // 1 == bitrate
@@ -298,7 +298,7 @@ QString Transcoder::GetFile(const QString &input, const TranscoderPreset &preset
if (!fileinfo_output.isFile() || fileinfo_output.filePath().isEmpty() || fileinfo_output.path().isEmpty() || fileinfo_output.fileName().isEmpty() || fileinfo_output.suffix().isEmpty()) {
QFileInfo fileinfo_input(input);
QString temp_dir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/transcoder");
QString temp_dir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QLatin1String("/transcoder");
if (!QDir(temp_dir).exists()) QDir().mkpath(temp_dir);
QString filename = fileinfo_input.completeBaseName() + QLatin1Char('.') + preset.extension_;
fileinfo_output.setFile(temp_dir + QLatin1Char('/') + filename);
@@ -569,7 +569,7 @@ QMap<QString, float> Transcoder::GetProgress() const {
void Transcoder::SetElementProperties(const QString &name, GObject *object) {
Settings s;
s.beginGroup(QStringLiteral("Transcoder/") + name + settings_postfix_);
s.beginGroup(QLatin1String("Transcoder/") + name + settings_postfix_);
guint properties_count = 0;
GParamSpec **properties = g_object_class_list_properties(G_OBJECT_GET_CLASS(object), &properties_count);

View File

@@ -62,9 +62,9 @@ QString DesktopEnvironment() {
session = session.mid(slash + 1);
}
if (session == QStringLiteral("kde")) return QStringLiteral("KDE");
else if (session == QStringLiteral("gnome")) return QStringLiteral("Gnome");
else if (session == QStringLiteral("xfce")) return QStringLiteral("XFCE");
if (session == QLatin1String("kde")) return QStringLiteral("KDE");
else if (session == QLatin1String("gnome")) return QStringLiteral("Gnome");
else if (session == QLatin1String("xfce")) return QStringLiteral("XFCE");
return QStringLiteral("Unknown");

View File

@@ -31,7 +31,7 @@ QString MacAddress() {
for (QNetworkInterface &netif : QNetworkInterface::allInterfaces()) {
if (
(netif.hardwareAddress() == QStringLiteral("00:00:00:00:00:00")) ||
(netif.hardwareAddress() == QLatin1String("00:00:00:00:00:00")) ||
(netif.flags() & QNetworkInterface::IsLoopBack) ||
!(netif.flags() & QNetworkInterface::IsUp) ||
!(netif.flags() & QNetworkInterface::IsRunning)
@@ -41,7 +41,7 @@ QString MacAddress() {
}
}
if (ret.isEmpty()) ret = QStringLiteral("00:00:00:00:00:00");
if (ret.isEmpty()) ret = QLatin1String("00:00:00:00:00:00");
return ret;

View File

@@ -35,7 +35,7 @@ QString PrettySize(const quint64 bytes) {
if (bytes > 0LL) {
if (bytes <= 1000LL) {
ret = QString::number(bytes) + QStringLiteral(" bytes");
ret = QString::number(bytes) + QLatin1String(" bytes");
}
else if (bytes <= 1000LL * 1000LL) {
ret = QString::asprintf("%.1f KB", static_cast<float>(bytes) / 1000.0F);
@@ -86,7 +86,7 @@ QStringList Prepend(const QString &text, const QStringList &list) {
QStringList Updateify(const QStringList &list) {
QStringList ret(list);
for (int i = 0; i < ret.count(); ++i) ret[i].prepend(ret[i] + QStringLiteral(" = :"));
for (int i = 0; i < ret.count(); ++i) ret[i].prepend(ret[i] + QLatin1String(" = :"));
return ret;
}
@@ -136,61 +136,61 @@ QString ReplaceVariable(const QString &variable, const Song &song, const QString
QString value = variable;
if (variable == QStringLiteral("%title%")) {
if (variable == QLatin1String("%title%")) {
value = song.PrettyTitle();
}
else if (variable == QStringLiteral("%album%")) {
else if (variable == QLatin1String("%album%")) {
value = song.album();
}
else if (variable == QStringLiteral("%artist%")) {
else if (variable == QLatin1String("%artist%")) {
value = song.artist();
}
else if (variable == QStringLiteral("%albumartist%")) {
else if (variable == QLatin1String("%albumartist%")) {
value = song.effective_albumartist();
}
else if (variable == QStringLiteral("%track%")) {
else if (variable == QLatin1String("%track%")) {
value.setNum(song.track());
}
else if (variable == QStringLiteral("%disc%")) {
else if (variable == QLatin1String("%disc%")) {
value.setNum(song.disc());
}
else if (variable == QStringLiteral("%year%")) {
else if (variable == QLatin1String("%year%")) {
value = song.PrettyYear();
}
else if (variable == QStringLiteral("%originalyear%")) {
else if (variable == QLatin1String("%originalyear%")) {
value = song.PrettyOriginalYear();
}
else if (variable == QStringLiteral("%genre%")) {
else if (variable == QLatin1String("%genre%")) {
value = song.genre();
}
else if (variable == QStringLiteral("%composer%")) {
else if (variable == QLatin1String("%composer%")) {
value = song.composer();
}
else if (variable == QStringLiteral("%performer%")) {
else if (variable == QLatin1String("%performer%")) {
value = song.performer();
}
else if (variable == QStringLiteral("%grouping%")) {
else if (variable == QLatin1String("%grouping%")) {
value = song.grouping();
}
else if (variable == QStringLiteral("%length%")) {
else if (variable == QLatin1String("%length%")) {
value = song.PrettyLength();
}
else if (variable == QStringLiteral("%filename%")) {
else if (variable == QLatin1String("%filename%")) {
value = song.basefilename();
}
else if (variable == QStringLiteral("%url%")) {
else if (variable == QLatin1String("%url%")) {
value = song.url().toString();
}
else if (variable == QStringLiteral("%playcount%")) {
else if (variable == QLatin1String("%playcount%")) {
value.setNum(song.playcount());
}
else if (variable == QStringLiteral("%skipcount%")) {
else if (variable == QLatin1String("%skipcount%")) {
value.setNum(song.skipcount());
}
else if (variable == QStringLiteral("%rating%")) {
else if (variable == QLatin1String("%rating%")) {
value = song.PrettyRating();
}
else if (variable == QStringLiteral("%newline%")) {
else if (variable == QLatin1String("%newline%")) {
return QString(newline); // No HTML escaping, return immediately.
}

View File

@@ -50,7 +50,7 @@ QString PrettyTime(int seconds) {
}
QString PrettyTimeDelta(const int seconds) {
return (seconds >= 0 ? QStringLiteral("+") : QStringLiteral("-")) + PrettyTime(seconds);
return (seconds >= 0 ? QLatin1Char('+') : QLatin1Char('-')) + PrettyTime(seconds);
}
QString PrettyTimeNanosec(const qint64 nanoseconds) {

View File

@@ -131,19 +131,19 @@ public:
if ([event type] == NSEventTypeKeyDown && [event modifierFlags] & NSEventModifierFlagCommand) {
const QString keyString = toQString([event characters]);
if (keyString == QStringLiteral("a")) { // Cmd+a
if (keyString == QLatin1String("a")) { // Cmd+a
[self performSelector:@selector(selectText:)];
return YES;
}
else if (keyString == QStringLiteral("c")) { // Cmd+c
else if (keyString == QLatin1String("c")) { // Cmd+c
[[self currentEditor] copy: nil];
return YES;
}
else if (keyString == QStringLiteral("v")) { // Cmd+v
else if (keyString == QLatin1String("v")) { // Cmd+v
[[self currentEditor] paste: nil];
return YES;
}
else if (keyString == QStringLiteral("x")) { // Cmd+x
else if (keyString == QLatin1String("x")) { // Cmd+x
[[self currentEditor] cut: nil];
return YES;
}