Replace QLatin1String with operator _L1
This commit is contained in:
@@ -29,6 +29,8 @@
|
||||
#include "dynamicplaylistcontrols.h"
|
||||
#include "ui_dynamicplaylistcontrols.h"
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
DynamicPlaylistControls::DynamicPlaylistControls(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
ui_(new Ui_DynamicPlaylistControls) {
|
||||
@@ -45,7 +47,7 @@ DynamicPlaylistControls::DynamicPlaylistControls(QWidget *parent)
|
||||
stylesheet_file.close();
|
||||
QColor color = palette().color(QPalette::Light);
|
||||
color.setAlpha(50);
|
||||
stylesheet.replace(QLatin1String("%background"), QStringLiteral("rgba(%1, %2, %3, %4%5)").arg(QString::number(color.red()), QString::number(color.green()), QString::number(color.blue()), QString::number(color.alpha())).arg(QLatin1Char('%')));
|
||||
stylesheet.replace("%background"_L1, QStringLiteral("rgba(%1, %2, %3, %4%5)").arg(QString::number(color.red()), QString::number(color.green()), QString::number(color.blue()), QString::number(color.alpha())).arg(u'%'));
|
||||
setStyleSheet(stylesheet);
|
||||
}
|
||||
|
||||
|
||||
@@ -96,6 +96,7 @@
|
||||
|
||||
using std::make_shared;
|
||||
using namespace std::chrono_literals;
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
const char *Playlist::kSettingsGroup = "Playlist";
|
||||
const char *Playlist::kCddaMimeType = "x-content/audio-cdda";
|
||||
@@ -1410,7 +1411,7 @@ QString Playlist::column_name(const Column column) {
|
||||
break;
|
||||
}
|
||||
|
||||
return QLatin1String("");
|
||||
return ""_L1;
|
||||
|
||||
}
|
||||
|
||||
@@ -1428,7 +1429,7 @@ QString Playlist::abbreviated_column_name(const Column column) {
|
||||
return column_name;
|
||||
}
|
||||
|
||||
return QLatin1String("");
|
||||
return ""_L1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
#include "playlistparsers/cueparser.h"
|
||||
#include "smartplaylists/playlistgenerator.h"
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
using std::make_shared;
|
||||
|
||||
namespace {
|
||||
@@ -121,7 +122,7 @@ PlaylistBackend::PlaylistList PlaylistBackend::GetPlaylists(const GetPlaylistsFl
|
||||
}
|
||||
QString condition;
|
||||
if (!condition_list.isEmpty()) {
|
||||
condition = QLatin1String(" WHERE ") + condition_list.join(QLatin1String(" OR "));
|
||||
condition = " WHERE "_L1 + condition_list.join(" OR "_L1);
|
||||
}
|
||||
|
||||
SqlQuery q(db);
|
||||
@@ -302,7 +303,7 @@ PlaylistItemPtr PlaylistBackend::RestoreCueData(PlaylistItemPtr item, SharedPtr<
|
||||
QFile cue_file(cue_path);
|
||||
if (!cue_file.open(QIODevice::ReadOnly)) return item;
|
||||
|
||||
song_list = cue_parser.Load(&cue_file, cue_path, QDir(cue_path.section(QLatin1Char('/'), 0, -2)));
|
||||
song_list = cue_parser.Load(&cue_file, cue_path, QDir(cue_path.section(u'/', 0, -2)));
|
||||
cue_file.close();
|
||||
state->cached_cues_[cue_path] = song_list;
|
||||
}
|
||||
|
||||
@@ -71,6 +71,8 @@
|
||||
#include "playlist/playlist.h"
|
||||
#include "playlistdelegates.h"
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
namespace {
|
||||
constexpr int kQueueBoxBorder = 1;
|
||||
constexpr int kQueueBoxCornerRadius = 3;
|
||||
@@ -258,10 +260,10 @@ bool PlaylistDelegateBase::helpEvent(QHelpEvent *event, QAbstractItemView *view,
|
||||
// Special case: we want newlines in the comment tooltip
|
||||
if (idx.column() == static_cast<int>(Playlist::Column::Comment)) {
|
||||
text = idx.data(Qt::ToolTipRole).toString().toHtmlEscaped();
|
||||
text.replace(QLatin1String("\\r\\n"), QLatin1String("<br />"));
|
||||
text.replace(QLatin1String("\\n"), QLatin1String("<br />"));
|
||||
text.replace(QLatin1String("\r\n"), QLatin1String("<br />"));
|
||||
text.replace(QLatin1String("\n"), QLatin1String("<br />"));
|
||||
text.replace("\\r\\n"_L1, "<br />"_L1);
|
||||
text.replace("\\n"_L1, "<br />"_L1);
|
||||
text.replace("\r\n"_L1, "<br />"_L1);
|
||||
text.replace("\n"_L1, "<br />"_L1);
|
||||
}
|
||||
|
||||
if (text.isEmpty() || !event) return false;
|
||||
@@ -440,7 +442,7 @@ QString NativeSeparatorsDelegate::displayText(const QVariant &value, const QLoca
|
||||
if (value.metaType().id() == QMetaType::QUrl) {
|
||||
url = value.toUrl();
|
||||
}
|
||||
else if (string_value.contains(QLatin1String("://"))) {
|
||||
else if (string_value.contains("://"_L1)) {
|
||||
url = QUrl::fromEncoded(string_value.toLatin1());
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -218,7 +218,7 @@ void PlaylistListContainer::NewFolderClicked() {
|
||||
return;
|
||||
}
|
||||
|
||||
name.replace(QLatin1Char('/'), QLatin1Char(' '));
|
||||
name.replace(u'/', u' ');
|
||||
|
||||
model_->invisibleRootItem()->appendRow(model_->NewFolder(name));
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ QString PlaylistListModel::ItemPath(const QStandardItem *item) {
|
||||
current = current->parent();
|
||||
}
|
||||
|
||||
return components.join(QLatin1Char('/'));
|
||||
return components.join(u'/');
|
||||
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ QStandardItem *PlaylistListModel::FolderByPath(const QString &path) {
|
||||
// inefficient but maintaining a path -> item map is difficult.
|
||||
QStandardItem *parent = invisibleRootItem();
|
||||
|
||||
const QStringList parts = path.split(QLatin1Char('/'), Qt::SkipEmptyParts);
|
||||
const QStringList parts = path.split(u'/', Qt::SkipEmptyParts);
|
||||
for (const QString &part : parts) {
|
||||
QStandardItem *matching_child = nullptr;
|
||||
|
||||
|
||||
@@ -61,6 +61,8 @@
|
||||
#include "playlistparsers/playlistparser.h"
|
||||
#include "dialogs/saveplaylistsdialog.h"
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
class ParserBase;
|
||||
|
||||
PlaylistManager::PlaylistManager(Application *app, QObject *parent)
|
||||
@@ -453,7 +455,7 @@ void PlaylistManager::UpdateSummaryText() {
|
||||
summary += tr("%n track(s)", "", tracks);
|
||||
|
||||
if (nanoseconds > 0) {
|
||||
summary += QLatin1String(" - [ ") + Utilities::WordyTimeNanosec(nanoseconds) + QLatin1String(" ]");
|
||||
summary += " - [ "_L1 + Utilities::WordyTimeNanosec(nanoseconds) + " ]"_L1;
|
||||
}
|
||||
|
||||
Q_EMIT SummaryTextChanged(summary);
|
||||
@@ -571,7 +573,7 @@ QString PlaylistManager::GetNameForNewPlaylist(const SongList &songs) {
|
||||
|
||||
if (!various_artists && albums.size() == 1) {
|
||||
QStringList album_names = albums.values();
|
||||
result += QLatin1String(" - ") + album_names.first();
|
||||
result += " - "_L1 + album_names.first();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -54,6 +54,8 @@
|
||||
#include "playlistmanager.h"
|
||||
#include "playlisttabbar.h"
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
namespace {
|
||||
constexpr char kSettingsGroup[] = "PlaylistTabBar";
|
||||
constexpr int kDragHoverTimeout = 500;
|
||||
@@ -334,7 +336,7 @@ void PlaylistTabBar::RemoveTab(const int id) {
|
||||
void PlaylistTabBar::set_text_by_id(const int id, const QString &text) {
|
||||
|
||||
QString new_text = text;
|
||||
new_text = new_text.replace(QLatin1Char('&'), QLatin1String("&&"));
|
||||
new_text = new_text.replace(u'&', "&&"_L1);
|
||||
setTabText(index_of(id), new_text);
|
||||
setTabToolTip(index_of(id), text);
|
||||
|
||||
@@ -347,8 +349,8 @@ void PlaylistTabBar::CurrentIndexChanged(const int index) {
|
||||
void PlaylistTabBar::InsertTab(const int id, const int index, const QString &text, const bool favorite) {
|
||||
|
||||
QString new_text = text;
|
||||
if (new_text.contains(QLatin1Char('&'))) {
|
||||
new_text = new_text.replace(QLatin1Char('&'), QLatin1String("&&"));
|
||||
if (new_text.contains(u'&')) {
|
||||
new_text = new_text.replace(u'&', "&&"_L1);
|
||||
}
|
||||
|
||||
suppress_current_changed_ = true;
|
||||
|
||||
@@ -81,6 +81,8 @@
|
||||
# include "moodbar/moodbaritemdelegate.h"
|
||||
#endif
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
namespace {
|
||||
constexpr int kGlowIntensitySteps = 24;
|
||||
constexpr int kAutoscrollGraceTimeout = 30; // seconds
|
||||
@@ -1387,7 +1389,7 @@ void PlaylistView::CopyCurrentSongToClipboard() const {
|
||||
|
||||
QMimeData *mime_data = new QMimeData;
|
||||
mime_data->setUrls(QList<QUrl>() << url);
|
||||
mime_data->setText(columns.join(QLatin1String(" - ")));
|
||||
mime_data->setText(columns.join(" - "_L1));
|
||||
|
||||
QApplication::clipboard()->setMimeData(mime_data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user