Commit de9abfd1 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use QLatin1Char and other

parent 08b6b94b
......@@ -829,7 +829,7 @@ void Bin::slotDeleteClip()
QString subId = item->clipId();
sub = static_cast<ProjectSubClip *>(item);
zone = sub->zone();
subId.append(":" + QString::number(zone.x()) + ":" + QString::number(zone.y()));
subId.append(":" + QString::number(zone.x()) + QLatin1Char(':') + QString::number(zone.y()));
subClipIds << subId;
continue;
}
......@@ -1912,7 +1912,7 @@ void Bin::slotThumbnailReady(const QString &id, const QImage &img, bool fromFile
// Save thumbnail for later reuse
bool ok = false;
if (!fromFile) {
img.save(m_doc->getCacheDir(CacheThumbs, &ok).absoluteFilePath(clip->hash() + ".png"));
img.save(m_doc->getCacheDir(CacheThumbs, &ok).absoluteFilePath(clip->hash() + QStringLiteral(".png")));
}
}
}
......@@ -2831,7 +2831,7 @@ void Bin::renameSubClip(const QString &id, const QString &newName, const QString
}
sub->setName(newName);
clip->setProducerProperty("kdenlive:clipzone." + oldName, QString());
clip->setProducerProperty("kdenlive:clipzone." + newName, QString::number(in) + ";" + QString::number(out));
clip->setProducerProperty("kdenlive:clipzone." + newName, QString::number(in) + QLatin1Char(';') + QString::number(out));
emit itemUpdated(sub);
}
......@@ -3099,7 +3099,7 @@ void Bin::slotGotFilterJobResults(const QString &id, int startPos, int track, co
QString label = filterInfo.value(QStringLiteral("label"));
QString key = filterInfo.value(QStringLiteral("key"));
int offset = filterInfo.value(QStringLiteral("offset")).toInt();
QStringList value = results.value(key).split(';', QString::SkipEmptyParts);
QStringList value = results.value(key).split(QLatin1Char(';'), QString::SkipEmptyParts);
//qCDebug(KDENLIVE_LOG)<<"// RESULT; "<<key<<" = "<<value;
if (filterInfo.contains(QStringLiteral("resultmessage"))) {
QString mess = filterInfo.value(QStringLiteral("resultmessage"));
......
......@@ -303,7 +303,7 @@ public:
} else if (jobProgress == JobCrashed) {
QString jobText = index.data(AbstractProjectItem::JobMessage).toString();
if (!jobText.isEmpty()) {
QRectF txtBounding = painter->boundingRect(r2, Qt::AlignRight | Qt::AlignVCenter, " " + jobText + " ");
QRectF txtBounding = painter->boundingRect(r2, Qt::AlignRight | Qt::AlignVCenter, QLatin1Char(' ') + jobText + QLatin1Char(' '));
painter->setPen(Qt::NoPen);
painter->setBrush(option.palette.highlight());
painter->drawRoundedRect(txtBounding, 2, 2);
......
......@@ -901,7 +901,7 @@ void ProjectClip::doExtractIntra()
if (pos >= max) {
pos = max - 1;
}
const QString path = url() + '_' + QString::number(pos);
const QString path = url() + QLatin1Char('_') + QString::number(pos);
QImage img = bin()->findCachedPixmap(path);
if (!img.isNull()) {
// Cache already contains image
......@@ -948,14 +948,14 @@ void ProjectClip::doExtractImage()
m_thumbMutex.lock();
int pos = m_requestedThumbs.takeFirst();
m_thumbMutex.unlock();
if (ok && thumbFolder.exists(hash() + '#' + QString::number(pos) + ".png")) {
emit thumbReady(pos, QImage(thumbFolder.absoluteFilePath(hash() + '#' + QString::number(pos) + ".png")));
if (ok && thumbFolder.exists(hash() + '#' + QString::number(pos) + QStringLiteral(".png"))) {
emit thumbReady(pos, QImage(thumbFolder.absoluteFilePath(hash() + '#' + QString::number(pos) + QStringLiteral(".png"))));
continue;
}
if (pos >= max) {
pos = max - 1;
}
const QString path = url() + '_' + QString::number(pos);
const QString path = url() + QLatin1Char('_') + QString::number(pos);
QImage img = bin()->findCachedPixmap(path);
if (!img.isNull()) {
emit thumbReady(pos, img);
......@@ -1012,7 +1012,7 @@ const QString ProjectClip::getAudioThumbPath(AudioStreamInfo *audioInfo)
QDir thumbFolder = bin()->getCacheDir(CacheAudio, &ok);
QString audioPath = thumbFolder.absoluteFilePath(clipHash);
if (audioStream > 0) {
audioPath.append("_" + QString::number(audioInfo->audio_index()));
audioPath.append(QLatin1Char('_') + QString::number(audioInfo->audio_index()));
}
int roundedFps = (int) m_controller->profile()->fps();
audioPath.append(QStringLiteral("_%1_audio.png").arg(roundedFps));
......@@ -1351,7 +1351,7 @@ QStringList ProjectClip::updatedAnalysisData(const QString &name, const QString
previous = m_controller->property("kdenlive:clipanalysis." + name + QString::number(i));
}
return QStringList() << QString("kdenlive:clipanalysis." + name + QString::number(i)) << geometryWithOffset(data, offset);
//m_controller->setProperty("kdenlive:clipanalysis." + name + ' ' + QString::number(i), geometryWithOffset(data, offset));
//m_controller->setProperty("kdenlive:clipanalysis." + name + QLatin1Char(' ') + QString::number(i), geometryWithOffset(data, offset));
}
} else {
return QStringList() << QString("kdenlive:clipanalysis." + name) << geometryWithOffset(data, offset);
......@@ -1386,7 +1386,7 @@ const QString ProjectClip::geometryWithOffset(const QString &data, int offset)
QImage ProjectClip::findCachedThumb(int pos)
{
const QString path = url() + '_' + QString::number(pos);
const QString path = url() + QLatin1Char('_') + QString::number(pos);
return bin()->findCachedPixmap(path);
}
......
......@@ -139,7 +139,7 @@ bool ProjectItemModel::dropMimeData(const QMimeData *data, Qt::DropAction action
if (data->hasFormat(QStringLiteral("kdenlive/producerslist"))) {
// Dropping an Bin item
QStringList ids = QString(data->data(QStringLiteral("kdenlive/producerslist"))).split(';');
QStringList ids = QString(data->data(QStringLiteral("kdenlive/producerslist"))).split(QLatin1Char(';'));
emit itemDropped(ids, parent);
return true;
}
......@@ -152,7 +152,7 @@ bool ProjectItemModel::dropMimeData(const QMimeData *data, Qt::DropAction action
}
if (data->hasFormat(QStringLiteral("kdenlive/clip"))) {
QStringList list = QString(data->data(QStringLiteral("kdenlive/clip"))).split(';');
QStringList list = QString(data->data(QStringLiteral("kdenlive/clip"))).split(QLatin1Char(';'));
emit addClipCut(list.at(0), list.at(1).toInt(), list.at(2).toInt());
}
......@@ -273,7 +273,7 @@ QMimeData *ProjectItemModel::mimeData(const QModelIndexList &indices) const
list << item->clipId();
} else if (type == AbstractProjectItem::SubClipItem) {
QPoint p = item->zone();
list << item->clipId() + "/" + QString::number(p.x()) + "/" + QString::number(p.y());
list << item->clipId() + QLatin1Char('/') + QString::number(p.x()) + QLatin1Char('/') + QString::number(p.y());
} else if (type == AbstractProjectItem::FolderItem) {
list << "#" + item->clipId();
}
......
......@@ -46,7 +46,7 @@ ProjectSubClip::ProjectSubClip(ProjectClip *parent, int in, int out, const QStri
setParent(parent);
m_duration = timecode;
// Save subclip in MLT
parent->setProducerProperty("kdenlive:clipzone." + m_name, QString::number(in) + ";" + QString::number(out));
parent->setProducerProperty("kdenlive:clipzone." + m_name, QString::number(in) + QLatin1Char(';') + QString::number(out));
connect(parent, &ProjectClip::thumbReady, this, &ProjectSubClip::gotThumb);
}
......
......@@ -197,7 +197,7 @@ void CommentedTime::setMarkerType(int t)
QString CommentedTime::hash() const
{
return QString::number(type) + ":" + (c.isEmpty() ? i18n("Marker") : c);
return QString::number(type) + QLatin1Char(':') + (c.isEmpty() ? i18n("Marker") : c);
}
int CommentedTime::markerType() const
......
......@@ -314,7 +314,7 @@ public:
QString comment() const;
GenTime time() const;
/** @brief Returns a string containing infos needed to store marker info. string equals marker type + ":" + marker comment */
/** @brief Returns a string containing infos needed to store marker info. string equals marker type + QLatin1Char(':') + marker comment */
QString hash() const;
void setComment(const QString &comm);
void setMarkerType(int t);
......
......@@ -513,12 +513,12 @@ void KdenliveSettingsDialog::initDevices()
QString deviceId;
while (!line.isNull()) {
if (line.contains(QStringLiteral("playback"))) {
deviceId = line.section(':', 0, 0);
m_configSdl.kcfg_audio_device->addItem(line.section(':', 1, 1), "plughw:" + QString::number(deviceId.section(QLatin1Char('-'), 0, 0).toInt()) + ',' + QString::number(deviceId.section(QLatin1Char('-'), 1, 1).toInt()));
deviceId = line.section(QLatin1Char(':'), 0, 0);
m_configSdl.kcfg_audio_device->addItem(line.section(QLatin1Char(':'), 1, 1), "plughw:" + QString::number(deviceId.section(QLatin1Char('-'), 0, 0).toInt()) + ',' + QString::number(deviceId.section(QLatin1Char('-'), 1, 1).toInt()));
}
if (line.contains(QStringLiteral("capture"))) {
deviceId = line.section(':', 0, 0);
m_configCapture.kcfg_v4l_alsadevice->addItem(line.section(':', 1, 1).simplified(), "hw:" + QString::number(deviceId.section(QLatin1Char('-'), 0, 0).toInt()) + ',' + QString::number(deviceId.section(QLatin1Char('-'), 1, 1).toInt()));
deviceId = line.section(QLatin1Char(':'), 0, 0);
m_configCapture.kcfg_v4l_alsadevice->addItem(line.section(QLatin1Char(':'), 1, 1).simplified(), "hw:" + QString::number(deviceId.section(QLatin1Char('-'), 0, 0).toInt()) + ',' + QString::number(deviceId.section(QLatin1Char('-'), 1, 1).toInt()));
}
line = stream.readLine();
}
......@@ -567,10 +567,10 @@ void KdenliveSettingsDialog::slotReadAudioDevices()
for (const QString &data : lines) {
////qCDebug(KDENLIVE_LOG) << "// READING LINE: " << data;
if (!data.startsWith(' ') && data.count(':') > 1) {
QString card = data.section(':', 0, 0).section(QLatin1Char(' '), -1);
QString device = data.section(':', 1, 1).section(QLatin1Char(' '), -1);
m_configSdl.kcfg_audio_device->addItem(data.section(':', -1).simplified(), "plughw:" + card + ',' + device);
m_configCapture.kcfg_v4l_alsadevice->addItem(data.section(':', -1).simplified(), "hw:" + card + ',' + device);
QString card = data.section(QLatin1Char(':'), 0, 0).section(QLatin1Char(' '), -1);
QString device = data.section(QLatin1Char(':'), 1, 1).section(QLatin1Char(' '), -1);
m_configSdl.kcfg_audio_device->addItem(data.section(QLatin1Char(':'), -1).simplified(), "plughw:" + card + ',' + device);
m_configCapture.kcfg_v4l_alsadevice->addItem(data.section(QLatin1Char(':'), -1).simplified(), "hw:" + card + ',' + device);
}
}
}
......@@ -1095,14 +1095,14 @@ void KdenliveSettingsDialog::slotUpdatev4lDevice()
QString pixelFormat;
QStringList itemRates;
for (int i = 0; i < pixelformats.count(); ++i) {
QString format = pixelformats.at(i).section(':', 0, 0);
QString format = pixelformats.at(i).section(QLatin1Char(':'), 0, 0);
QStringList sizes = pixelformats.at(i).split(':', QString::SkipEmptyParts);
pixelFormat = sizes.takeFirst();
for (int j = 0; j < sizes.count(); ++j) {
itemSize = sizes.at(j).section(QLatin1Char('='), 0, 0);
itemRates = sizes.at(j).section(QLatin1Char('='), 1, 1).split(',', QString::SkipEmptyParts);
for (int k = 0; k < itemRates.count(); ++k) {
m_configCapture.kcfg_v4l_format->addItem('[' + format + "] " + itemSize + " (" + itemRates.at(k) + ')', QStringList() << format << itemSize.section('x', 0, 0) << itemSize.section('x', 1, 1) << itemRates.at(k).section(QLatin1Char('/'), 0, 0) << itemRates.at(k).section(QLatin1Char('/'), 1, 1));
m_configCapture.kcfg_v4l_format->addItem('[' + format + "] " + itemSize + " (" + itemRates.at(k) + QLatin1Char(')'), QStringList() << format << itemSize.section('x', 0, 0) << itemSize.section('x', 1, 1) << itemRates.at(k).section(QLatin1Char('/'), 0, 0) << itemRates.at(k).section(QLatin1Char('/'), 1, 1));
}
}
}
......@@ -1119,9 +1119,9 @@ void KdenliveSettingsDialog::slotUpdatev4lCaptureProfile()
return;
}
m_configCapture.p_size->setText(info.at(1) + 'x' + info.at(2));
m_configCapture.p_fps->setText(info.at(3) + '/' + info.at(4));
m_configCapture.p_fps->setText(info.at(3) + QLatin1Char('/') + info.at(4));
m_configCapture.p_aspect->setText(QStringLiteral("1/1"));
m_configCapture.p_display->setText(info.at(1) + '/' + info.at(2));
m_configCapture.p_display->setText(info.at(1) + QLatin1Char('/') + info.at(2));
m_configCapture.p_colorspace->setText(ProfilesDialog::getColorspaceDescription(601));
m_configCapture.p_progressive->setText(i18n("Progressive"));
......@@ -1155,9 +1155,9 @@ void KdenliveSettingsDialog::loadCurrentV4lProfileInfo()
prof = ProfilesDialog::getVideoProfile(dir.absoluteFilePath(QStringLiteral("video4linux")));
}
m_configCapture.p_size->setText(QString::number(prof.width) + 'x' + QString::number(prof.height));
m_configCapture.p_fps->setText(QString::number(prof.frame_rate_num) + '/' + QString::number(prof.frame_rate_den));
m_configCapture.p_aspect->setText(QString::number(prof.sample_aspect_num) + '/' + QString::number(prof.sample_aspect_den));
m_configCapture.p_display->setText(QString::number(prof.display_aspect_num) + '/' + QString::number(prof.display_aspect_den));
m_configCapture.p_fps->setText(QString::number(prof.frame_rate_num) + QLatin1Char('/') + QString::number(prof.frame_rate_den));
m_configCapture.p_aspect->setText(QString::number(prof.sample_aspect_num) + QLatin1Char('/') + QString::number(prof.sample_aspect_den));
m_configCapture.p_display->setText(QString::number(prof.display_aspect_num) + QLatin1Char('/') + QString::number(prof.display_aspect_den));
m_configCapture.p_colorspace->setText(ProfilesDialog::getColorspaceDescription(prof.colorspace));
if (prof.progressive) {
m_configCapture.p_progressive->setText(i18n("Progressive"));
......
......@@ -414,8 +414,8 @@ void RenderWidget::setGuides(const QMap<double, QString> &guidesData, double dur
i.next();
GenTime pos = GenTime(i.key());
const QString guidePos = Timecode::getStringTimecode(pos.frames(fps), fps);
m_view.guide_start->addItem(i.value() + '/' + guidePos, i.key());
m_view.guide_end->addItem(i.value() + '/' + guidePos, i.key());
m_view.guide_start->addItem(i.value() + QLatin1Char('/') + guidePos, i.key());
m_view.guide_end->addItem(i.value() + QLatin1Char('/') + guidePos, i.key());
}
if (!guidesData.isEmpty()) {
m_view.guide_end->addItem(i18n("End"), QString::number(duration));
......@@ -1030,7 +1030,7 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut,
imageSequences << QStringLiteral("jpg") << QStringLiteral("png") << QStringLiteral("bmp") << QStringLiteral("dpx") << QStringLiteral("ppm") << QStringLiteral("tga") << QStringLiteral("tif");
if (imageSequences.contains(extension)) {
// format string for counter?
if (!QRegExp(".*%[0-9]*d.*").exactMatch(dest)) {
if (!QRegExp(QStringLiteral(".*%[0-9]*d.*")).exactMatch(dest)) {
dest = dest.section(QLatin1Char('.'), 0, -2) + "_%05d." + extension;
}
}
......@@ -1245,7 +1245,7 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut,
sEngine.globalObject().setProperty(QStringLiteral("quality"), m_view.video->value());
sEngine.globalObject().setProperty(QStringLiteral("audiobitrate"), m_view.audio->value());
sEngine.globalObject().setProperty(QStringLiteral("audioquality"), m_view.audio->value());
sEngine.globalObject().setProperty(QStringLiteral("dar"), '@' + QString::number(m_profile.display_aspect_num) + '/' + QString::number(m_profile.display_aspect_den));
sEngine.globalObject().setProperty(QStringLiteral("dar"), '@' + QString::number(m_profile.display_aspect_num) + QLatin1Char('/') + QString::number(m_profile.display_aspect_den));
sEngine.globalObject().setProperty(QStringLiteral("passes"), static_cast<int>(m_view.checkTwoPass->isChecked()) + 1);
for (int i = 0; i < paramsList.count(); ++i) {
......@@ -1258,7 +1258,7 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut,
// evaluate expression
if (paramValue.startsWith('%')) {
paramValue = sEngine.evaluate(paramValue.remove(0, 1)).toString();
paramsList[i] = paramName + '=' + paramValue;
paramsList[i] = paramName + QLatin1Char('=') + paramValue;
}
sEngine.globalObject().setProperty(paramName.toUtf8().constData(), paramValue);
}
......@@ -1821,7 +1821,7 @@ void RenderWidget::parseMltPresets()
} else if (!acodec.isEmpty()) {
profileName.append(acodec);
}
profileName.append(")");
profileName.append(QLatin1Char(')'));
}
QTreeWidgetItem *item = new QTreeWidgetItem(QStringList(profileName));
item->setData(0, ExtensionRole, extension);
......@@ -2011,7 +2011,7 @@ void RenderWidget::parseFile(const QString &exportFile, bool editable)
item->setData(0, AudioBitratesRole, profile.attribute(QStringLiteral("audiobitrates")).split(',', QString::SkipEmptyParts));
}
if (profile.hasAttribute(QStringLiteral("speeds"))) {
item->setData(0, SpeedsRole, profile.attribute(QStringLiteral("speeds")).split(';', QString::SkipEmptyParts));
item->setData(0, SpeedsRole, profile.attribute(QStringLiteral("speeds")).split(QLatin1Char(';'), QString::SkipEmptyParts));
}
if (profile.hasAttribute(QStringLiteral("url"))) {
item->setData(0, ExtraRole, profile.attribute(QStringLiteral("url")));
......@@ -2097,7 +2097,7 @@ void RenderWidget::parseFile(const QString &exportFile, bool editable)
item->setData(0, AudioBitratesRole, profileElement.attribute(QStringLiteral("audiobitrates")).split(',', QString::SkipEmptyParts));
}
if (profileElement.hasAttribute(QStringLiteral("speeds"))) {
item->setData(0, SpeedsRole, profileElement.attribute(QStringLiteral("speeds")).split(';', QString::SkipEmptyParts));
item->setData(0, SpeedsRole, profileElement.attribute(QStringLiteral("speeds")).split(QLatin1Char(';'), QString::SkipEmptyParts));
}
if (profileElement.hasAttribute(QStringLiteral("url"))) {
item->setData(0, ExtraRole, profileElement.attribute(QStringLiteral("url")));
......
......@@ -35,7 +35,7 @@ TitleTemplateDialog::TitleTemplateDialog(const QString &folder, QWidget *parent)
m_view.setupUi(this);
// Get the list of existing templates
const QStringList filter = { QStringLiteral("*.kdenlivetitle") };
const QString path = folder + "/titles/";
const QString path = folder + QStringLiteral("/titles/");
// Project templates
QDir dir(path);
......
......@@ -289,14 +289,14 @@ void Wizard::slotUpdateCaptureParameters()
QString pixelFormat;
QStringList itemRates;
for (int i = 0; i < pixelformats.count(); ++i) {
QString format = pixelformats.at(i).section(':', 0, 0);
QString format = pixelformats.at(i).section(QLatin1Char(':'), 0, 0);
QStringList sizes = pixelformats.at(i).split(':', QString::SkipEmptyParts);
pixelFormat = sizes.takeFirst();
for (int j = 0; j < sizes.count(); ++j) {
itemSize = sizes.at(j).section(QLatin1Char('='), 0, 0);
itemRates = sizes.at(j).section(QLatin1Char('='), 1, 1).split(',', QString::SkipEmptyParts);
for (int k = 0; k < itemRates.count(); ++k) {
QString formatDescription = '[' + format + "] " + itemSize + " (" + itemRates.at(k) + ')';
QString formatDescription = '[' + format + "] " + itemSize + " (" + itemRates.at(k) + QLatin1Char(')');
if (m_capture.v4l_formats->findText(formatDescription) == -1) {
m_capture.v4l_formats->addItem(formatDescription, QStringList() << format << itemSize.section('x', 0, 0) << itemSize.section('x', 1, 1) << itemRates.at(k).section(QLatin1Char('/'), 0, 0) << itemRates.at(k).section(QLatin1Char('/'), 1, 1));
}
......
......@@ -257,9 +257,9 @@ bool DocumentChecker::hasErrorInClips()
continue;
}
if (filePath.endsWith(QLatin1String(".pgm"))) {
fixedLuma = filePath.section(QLatin1Char('.') , 0, -2) + ".png";
fixedLuma = filePath.section(QLatin1Char('.') , 0, -2) + QStringLiteral(".png");
} else if (filePath.endsWith(QLatin1String(".png"))) {
fixedLuma = filePath.section(QLatin1Char('.'), 0, -2) + ".pgm";
fixedLuma = filePath.section(QLatin1Char('.'), 0, -2) + QStringLiteral(".pgm");
}
if (!fixedLuma.isEmpty() && QFile::exists(fixedLuma)) {
// Auto replace pgm with png for lumas
......@@ -280,7 +280,7 @@ bool DocumentChecker::hasErrorInClips()
luma = getProperty(transition, QStringLiteral("luma"));
}
if (!luma.isEmpty() && autoFixLuma.contains(luma)) {
setProperty(transition, service == QLatin1String("luma") ? "resource" : "luma", autoFixLuma.value(luma));
setProperty(transition, service == QLatin1String("luma") ? QStringLiteral("resource") : QStringLiteral("luma"), autoFixLuma.value(luma));
}
}
}
......@@ -392,13 +392,13 @@ bool DocumentChecker::hasErrorInClips()
}
if (!missingProxies.isEmpty()) {
if (!m_ui.infoLabel->text().isEmpty()) {
m_ui.infoLabel->setText(m_ui.infoLabel->text() + ". ");
m_ui.infoLabel->setText(m_ui.infoLabel->text() + QStringLiteral(". "));
}
m_ui.infoLabel->setText(m_ui.infoLabel->text() + i18n("Missing proxies will be recreated after opening."));
}
if (!missingSources.isEmpty()) {
if (!m_ui.infoLabel->text().isEmpty()) {
m_ui.infoLabel->setText(m_ui.infoLabel->text() + ". ");
m_ui.infoLabel->setText(m_ui.infoLabel->text() + QStringLiteral(". "));
}
m_ui.infoLabel->setText(m_ui.infoLabel->text() + i18np("The project file contains a missing clip, you can still work with its proxy.", "The project file contains %1 missing clips, you can still work with their proxies.", missingSources.count()));
}
......@@ -435,7 +435,7 @@ bool DocumentChecker::hasErrorInClips()
bool slowmotion = false;
if (parentId.startsWith(QLatin1String("slowmotion"))) {
slowmotion = true;
parentId = parentId.section(':', 1, 1);
parentId = parentId.section(QLatin1Char(':'), 1, 1);
}
if (parentId.contains(QLatin1Char('_'))) {
parentId = parentId.section(QLatin1Char('_'), 0, 0);
......@@ -445,7 +445,7 @@ bool DocumentChecker::hasErrorInClips()
QString suffix;
QString resource = EffectsList::property(mltProd, QStringLiteral("resource"));
if (slowmotion) {
suffix = '?' + resource.section(QLatin1Char('?'), -1);
suffix = QLatin1Char('?') + resource.section(QLatin1Char('?'), -1);
}
EffectsList::setProperty(mltProd, QStringLiteral("resource"), realPath + suffix);
if (prodId == id) {
......@@ -579,7 +579,7 @@ void DocumentChecker::slotSearchClips()
if (!clipPath.isEmpty()) {
fixed = true;
child->setText(1, clipPath);
child->setIcon(0, perfectMatch ? KoIconUtils::themedIcon("dialog-ok") : KoIconUtils::themedIcon("dialog-warning"));
child->setIcon(0, perfectMatch ? KoIconUtils::themedIcon(QStringLiteral("dialog-ok")) : KoIconUtils::themedIcon(QStringLiteral("dialog-warning")));
child->setData(0, statusRole, CLIPOK);
}
} else if (child->data(0, statusRole).toInt() == LUMAMISSING) {
......@@ -635,7 +635,7 @@ QString DocumentChecker::searchLuma(const QDir &dir, const QString &file) const
return result.filePath();
}
// Try in Kdenlive's standard KDE path
QString res = QStandardPaths::locate(QStandardPaths::AppDataLocation, "lumas/" + fname);
QString res = QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("lumas/") + fname);
if (!res.isEmpty()) {
return res;
}
......@@ -795,14 +795,14 @@ void DocumentChecker::fixProxyClip(const QString &id, const QString &oldUrl, con
QString sourceId = e.attribute(QStringLiteral("id"));
QString parentId = sourceId.section(QLatin1Char('_'), 0, 0);
if (parentId.startsWith(QLatin1String("slowmotion"))) {
parentId = parentId.section(':', 1, 1);
parentId = parentId.section(QLatin1Char(':'), 1, 1);
}
if (parentId == id) {
// Fix clip
QString resource = EffectsList::property(e, QStringLiteral("resource"));
// TODO: Slowmmotion clips
if (resource.contains(QRegExp("\\?[0-9]+\\.[0-9]+(&amp;strobe=[0-9]+)?$"))) {
//fixedResource.append('?' + resource.section(QLatin1Char('?'), -1));
if (resource.contains(QRegExp(QStringLiteral("\\?[0-9]+\\.[0-9]+(&amp;strobe=[0-9]+)?$")))) {
//fixedResource.append(QLatin1Char('?') + resource.section(QLatin1Char('?'), -1));
}
if (resource == oldUrl) {
EffectsList::setProperty(e, QStringLiteral("resource"), newUrl);
......@@ -827,14 +827,14 @@ void DocumentChecker::fixSourceClipItem(QTreeWidgetItem *child, const QDomNodeLi
QString sourceId = e.attribute(QStringLiteral("id"));
QString parentId = sourceId.section(QLatin1Char('_'), 0, 0);
if (parentId.startsWith(QLatin1String("slowmotion"))) {
parentId = parentId.section(':', 1, 1);
parentId = parentId.section(QLatin1Char(':'), 1, 1);
}
if (parentId == id) {
// Fix clip
QString resource = EffectsList::property(e, QStringLiteral("resource"));
QString fixedResource = child->text(1);
if (resource.contains(QRegExp("\\?[0-9]+\\.[0-9]+(&amp;strobe=[0-9]+)?$"))) {
fixedResource.append('?' + resource.section(QLatin1Char('?'), -1));
if (resource.contains(QRegExp(QStringLiteral("\\?[0-9]+\\.[0-9]+(&amp;strobe=[0-9]+)?$")))) {
fixedResource.append(QLatin1Char('?') + resource.section(QLatin1Char('?'), -1));
}
if (sourceId == id) {
// Only set originalurl on master producer
......@@ -889,17 +889,17 @@ void DocumentChecker::fixClipItem(QTreeWidgetItem *child, const QDomNodeList &pr
}*/
for (int i = 0; i < producers.count(); ++i) {
e = producers.item(i).toElement();
if (e.attribute(QStringLiteral("id")).section(QLatin1Char('_'), 0, 0) == id || e.attribute(QStringLiteral("id")).section(':', 1, 1) == id || e.attribute(QStringLiteral("id")) == id) {
if (e.attribute(QStringLiteral("id")).section(QLatin1Char('_'), 0, 0) == id || e.attribute(QStringLiteral("id")).section(QLatin1Char(':'), 1, 1) == id || e.attribute(QStringLiteral("id")) == id) {
// Fix clip
QString resource = getProperty(e, QStringLiteral("resource"));
QString service = getProperty(e, QStringLiteral("mlt_service"));
QString updatedResource = fixedResource;
if (resource.contains(QRegExp("\\?[0-9]+\\.[0-9]+(&amp;strobe=[0-9]+)?$"))) {
updatedResource.append('?' + resource.section(QLatin1Char('?'), -1));
if (resource.contains(QRegExp(QStringLiteral("\\?[0-9]+\\.[0-9]+(&amp;strobe=[0-9]+)?$")))) {
updatedResource.append(QLatin1Char('?') + resource.section(QLatin1Char('?'), -1));
}
if (service == QLatin1String("timewarp")) {
setProperty(e, QStringLiteral("warp_resource"), updatedResource);
updatedResource.prepend(getProperty(e, QStringLiteral("warp_speed")) + ":");
updatedResource.prepend(getProperty(e, QStringLiteral("warp_speed")) + QLatin1Char(':'));
}
setProperty(e, QStringLiteral("resource"), updatedResource);
}
......@@ -1040,7 +1040,7 @@ void DocumentChecker::slotDeleteSelected()
for (int i = 0; i < producers.count(); ++i) {
e = producers.item(i).toElement();
if (deletedIds.contains(e.attribute(QStringLiteral("id")).section(QLatin1Char('_'), 0, 0)) || deletedIds.contains(e.attribute(QStringLiteral("id")).section(':', 1, 1).section(QLatin1Char('_'), 0, 0))) {
if (deletedIds.contains(e.attribute(QStringLiteral("id")).section(QLatin1Char('_'), 0, 0)) || deletedIds.contains(e.attribute(QStringLiteral("id")).section(QLatin1Char(':'), 1, 1).section(QLatin1Char('_'), 0, 0))) {
// Remove clip
mlt.removeChild(e);
--i;
......@@ -1051,7 +1051,7 @@ void DocumentChecker::slotDeleteSelected()
QDomNodeList entries = playlists.at(i).toElement().elementsByTagName(QStringLiteral("entry"));
for (int j = 0; j < entries.count(); ++j) {
e = entries.item(j).toElement();
if (deletedIds.contains(e.attribute(QStringLiteral("producer")).section(QLatin1Char('_'), 0, 0)) || deletedIds.contains(e.attribute(QStringLiteral("producer")).section(':', 1, 1).section(QLatin1Char('_'), 0, 0))) {
if (deletedIds.contains(e.attribute(QStringLiteral("producer")).section(QLatin1Char('_'), 0, 0)) || deletedIds.contains(e.attribute(QStringLiteral("producer")).section(QLatin1Char(':'), 1, 1).section(QLatin1Char('_'), 0, 0))) {
// Replace clip with blank
while (e.childNodes().count() > 0) {
e.removeChild(e.firstChild());
......
......@@ -143,7 +143,7 @@ bool DocumentValidator::validate(const double currentVersion)
}
if (error) {
// Requested locale not available, ask for install
KMessageBox::sorry(QApplication::activeWindow(), i18n("The document was created in \"%1\" locale, which is not installed on your system. Please install that language pack. Until then, Kdenlive might not be able to correctly open the document.", mlt.attribute("LC_NUMERIC")));
KMessageBox::sorry(QApplication::activeWindow(), i18n("The document was created in \"%1\" locale, which is not installed on your system. Please install that language pack. Until then, Kdenlive might not be able to correctly open the document.", mlt.attribute(QStringLiteral("LC_NUMERIC"))));
}
// Make sure Qt locale and C++ locale have the same numeric separator, might not be the case
......@@ -152,7 +152,7 @@ bool DocumentValidator::validate(const double currentVersion)
#ifndef Q_OS_WIN
char *separator = localeconv()->decimal_point;
if (QString::fromUtf8(separator) != QString(documentLocale.decimalPoint())) {
KMessageBox::sorry(QApplication::activeWindow(), i18n("There is a locale conflict on your system. The document uses locale %1 which uses a \"%2\" as numeric separator (in system libraries) but Qt expects \"%3\". You might not be able to correctly open the project.", mlt.attribute("LC_NUMERIC"), documentLocale.decimalPoint(), separator));
KMessageBox::sorry(QApplication::activeWindow(), i18n("There is a locale conflict on your system. The document uses locale %1 which uses a \"%2\" as numeric separator (in system libraries) but Qt expects \"%3\". You might not be able to correctly open the project.", mlt.attribute(QStringLiteral("LC_NUMERIC")), documentLocale.decimalPoint(), separator));
//qDebug()<<"------\n!!! system locale is not similar to Qt's locale... be prepared for bugs!!!\n------";
// HACK: There is a locale conflict, so set locale to at least have correct decimal point
if (strncmp(separator, ".", 1) == 0) {
......@@ -203,7 +203,7 @@ bool DocumentValidator::validate(const double currentVersion)
// Last try: replace comma with a dot
QString versionString = kdenliveDoc.attribute(QStringLiteral("version"));
if (versionString.contains(QLatin1Char(','))) {
versionString.replace(',', '.');
versionString.replace(QLatin1Char(','), QLatin1Char('.'));
}
version = versionString.toDouble(&ok);
if (!ok) {
......@@ -404,10 +404,10 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
QDomNodeList kdenlivetracks = m_doc.elementsByTagName(QStringLiteral("kdenlivetrack"));
for (int i = 0; i < kdenlivetracks.count(); ++i) {
blank_playlist = m_doc.createElement(QStringLiteral("playlist"));
blank_playlist.setAttribute(QStringLiteral("id"), "playlist" + QString::number(i));
blank_playlist.setAttribute(QStringLiteral("id"), QStringLiteral("playlist") + QString::number(i));
westley.insertBefore(blank_playlist, QDomNode());
blank_track = m_doc.createElement(QStringLiteral("track"));
blank_track.setAttribute(QStringLiteral("producer"), "playlist" + QString::number(i));
blank_track.setAttribute(QStringLiteral("producer"), QStringLiteral("playlist") + QString::number(i));
blank_tractor.appendChild(blank_track);
if (kdenlivetracks.at(i).toElement().attribute(QStringLiteral("cliptype")) == QLatin1String("Sound")) {
blank_playlist.setAttribute(QStringLiteral("hide"), QStringLiteral("video"));
......@@ -586,7 +586,7 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
QDomElement prod = producers.at(i).toElement();
if (prod.attribute(QStringLiteral("mlt_service")) == QLatin1String("framebuffer")) {
QString slowmotionprod = prod.attribute(QStringLiteral("resource"));
slowmotionprod.replace(':', '?');
slowmotionprod.replace(QLatin1Char(':'), QLatin1Char('?'));
//qCDebug(KDENLIVE_LOG) << "// FOUND WRONG SLOWMO, new: " << slowmotionprod;
prod.setAttribute(QStringLiteral("resource"), slowmotionprod);
}
......@@ -668,7 +668,7 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
content.setAttribute(QStringLiteral("brushcolor"), colorToString(c));
QString rect = QStringLiteral("0,0,");
rect.append(ob.attribute(QStringLiteral("width")));
rect.append(",");
rect.append(QLatin1String(","));
rect.append(ob.attribute(QStringLiteral("height")));
content.setAttribute(QStringLiteral("rect"), rect);
item.appendChild(position);
......@@ -851,7 +851,7 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
////qCDebug(KDENLIVE_LOG) << "ready to set additional <avfile />'s attributes (id =" << id << ')';
kproducer.setAttribute(QStringLiteral("channels"), avfile.attribute(QStringLiteral("channels")));
kproducer.setAttribute(QStringLiteral("duration"), avfile.attribute(QStringLiteral("duration")));
kproducer.setAttribute(QStringLiteral("frame_size"), avfile.attribute(QStringLiteral("width")) + 'x' + avfile.attribute(QStringLiteral("height")));
kproducer.setAttribute(QStringLiteral("frame_size"), avfile.attribute(QStringLiteral("width")) + QLatin1Char('x') + avfile.attribute(QStringLiteral("height")));
kproducer.setAttribute(QStringLiteral("frequency"), avfile.attribute(QStringLiteral("frequency")));
if (kproducer.attribute(QStringLiteral("description")).isEmpty() && !avfile.attribute(QStringLiteral("description")).isEmpty()) {
kproducer.setAttribute(QStringLiteral("description"), avfile.attribute(QStringLiteral("description")));
......@@ -871,9 +871,9 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
QDomElement track = tracks.at(i).toElement();
if (track.attribute(QStringLiteral("producer")) != QLatin1String("black_track")) {
if (track.attribute(QStringLiteral("hide")) == QLatin1String("video")) {
tracksOrder.append('a');
tracksOrder.append(QLatin1Char('a'));
} else {
tracksOrder.append('v');
tracksOrder.append(QLatin1Char('v'));
}
}
}
......@@ -881,7 +881,7 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
QDomElement tracksinfo = m_doc.createElement(QStringLiteral("tracksinfo"));
for (int i = 0; i < tracksOrder.size(); ++i) {
QDomElement trackinfo = m_doc.createElement(QStringLiteral("trackinfo"));
if (tracksOrder.data()[i] == 'a') {
if (tracksOrder.data()[i] == QLatin1Char('a')) {
trackinfo.setAttribute(QStringLiteral("type"), QStringLiteral("audio"));
trackinfo.setAttribute(QStringLiteral("blind"), true);