Replace QStringLiteral with QLatin1String
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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_);
|
||||
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user