Commit 85e85cb2 authored by Vincent Pinon's avatar Vincent Pinon

krazy fix: QLatin1String for search functions

git grep -l "\(starts\|ends\)With(\(\"[^\"]*\"\))" | xargs sed -i
"s/\(starts\|ends\)With(\(\"[^\"]*\"\))/\1With(QLatin1String(\2))/g"
parent 4416b9b8
......@@ -72,7 +72,7 @@ int main(int argc, char **argv)
QUrl srcurl = QUrl::fromEncoded(srcString);
QString src = srcurl.path();
// The QUrl path() strips the consumer: protocol, so re-add it if necessary
if (srcString.startsWith("consumer:"))
if (srcString.startsWith(QLatin1String("consumer:")))
src.prepend(QLatin1String("consumer:"));
QUrl desturl = QUrl::fromEncoded(args.takeFirst().toUtf8());
QString dest = desturl.path();
......
......@@ -176,12 +176,12 @@ void ClipManager::slotGetThumbs()
m_processingThumbId = i.key();
QList<int> values = m_requestedThumbs.values(m_processingThumbId);
m_requestedThumbs.remove(m_processingThumbId);
if (m_processingThumbId.startsWith("?")) {
if (m_processingThumbId.startsWith(QLatin1String("?"))) {
// if id starts with ?, it means the request comes from a clip property widget
thumbType = 2;
m_processingThumbId.remove(0, 1);
}
if (m_processingThumbId.startsWith("#")) {
if (m_processingThumbId.startsWith(QLatin1String("#"))) {
// if id starts with #, it means the request comes from project tree
thumbType = 1;
m_processingThumbId.remove(0, 1);
......@@ -569,7 +569,7 @@ void ClipManager::slotAddClipList(const KUrl::List &urls, const QMap <QString, Q
if (data.contains("audio_index")) prod.setAttribute("audio_index", data.value("audio_index"));
KMimeType::Ptr type = KMimeType::findByUrl(file);
if (type->name().startsWith("image/")) {
if (type->name().startsWith(QLatin1String("image/"))) {
prod.setAttribute("type", (int) Image);
prod.setAttribute("in", 0);
prod.setAttribute("out", m_doc->getFramePos(KdenliveSettings::image_duration()) - 1);
......
......@@ -211,7 +211,7 @@ ClipProperties::ClipProperties(DocClipBase *clip, const Timecode &tc, double fps
if (values.count() > 1 && !values.at(1).isEmpty()) {
parentName = values.at(1);
} else {
if (KdenliveSettings::ffmpegpath().endsWith("avconv")) {
if (KdenliveSettings::ffmpegpath().endsWith(QLatin1String("avconv"))) {
parentName = i18n("Libav");
iconName = "meta_libav.png";
}
......@@ -509,7 +509,7 @@ ClipProperties::ClipProperties(DocClipBase *clip, const Timecode &tc, double fps
if (res.hasProperty(Nepomuk::Vocabulary::NIE::license())) {
QString ltype = res.property(Nepomuk::Vocabulary::NIE::licenseType()).toString();
m_view.clip_license->setText(i18n("License: %1", res.property(Nepomuk::Vocabulary::NIE::license()).toString()));
if (ltype.startsWith("http")) {
if (ltype.startsWith(QLatin1String("http"))) {
m_view.clip_license->setUrl(ltype);
connect(m_view.clip_license, SIGNAL(leftClickedUrl(QString)), this, SLOT(slotOpenUrl(QString)));
}
......@@ -530,7 +530,7 @@ ClipProperties::ClipProperties(DocClipBase *clip, const Timecode &tc, double fps
if (res.hasProperty(Nepomuk2::Vocabulary::NIE::license())) {
QString ltype = res.property(Nepomuk2::Vocabulary::NIE::licenseType()).toString();
m_view.clip_license->setText(i18n("License: %1", res.property(Nepomuk2::Vocabulary::NIE::license()).toString()));
if (ltype.startsWith("http")) {
if (ltype.startsWith(QLatin1String("http"))) {
m_view.clip_license->setUrl(ltype);
connect(m_view.clip_license, SIGNAL(leftClickedUrl(QString)), this, SLOT(slotOpenUrl(QString)));
}
......
......@@ -63,7 +63,7 @@ DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QStrin
QDomNamedNodeMap attributes = xml.attributes();
for (int i = 0; i < attributes.count(); ++i) {
QString name = attributes.item(i).nodeName();
if (name.startsWith("meta.attr.")) {
if (name.startsWith(QLatin1String("meta.attr."))) {
m_metadata.insert(name.section('.', 2), QStringList() << attributes.item(i).nodeValue());
} else m_properties.insert(name, attributes.item(i).nodeValue());
}
......@@ -578,7 +578,7 @@ void DocClipBase::setProducer(Mlt::Producer *producer, bool reset, bool readProp
}
else if (m_thumbProd && !m_thumbProd->hasProducer()) {
if (m_clipType != Audio) {
if (!id.endsWith("_audio"))
if (!id.endsWith(QLatin1String("_audio")))
m_thumbProd->setProducer(producer);
}
else m_thumbProd->setProducer(producer);
......@@ -588,7 +588,7 @@ void DocClipBase::setProducer(Mlt::Producer *producer, bool reset, bool readProp
if (id.contains('_')) {
// this is a subtrack producer, insert it at correct place
id = id.section('_', 1);
if (id.endsWith("audio")) {
if (id.endsWith(QLatin1String("audio"))) {
int pos = id.section('_', 0, 0).toInt();
if (pos >= m_audioTrackProducers.count()) {
while (m_audioTrackProducers.count() - 1 < pos) {
......@@ -600,7 +600,7 @@ void DocClipBase::setProducer(Mlt::Producer *producer, bool reset, bool readProp
}
else delete producer;
return;
} else if (id.endsWith("video")) {
} else if (id.endsWith(QLatin1String("video"))) {
int pos = 0;
// Keep compatibility with older projects where video only producers were not track specific
if (id.contains('_')) pos = id.section('_', 0, 0).toInt();
......
......@@ -101,7 +101,7 @@ bool DocumentChecker::hasErrorInClips()
mltProd = documentProducers.at(j).toElement();
prodId = mltProd.attribute("id");
// Don't check slowmotion clips for now... (TODO?)
if (prodId.startsWith("slowmotion")) continue;
if (prodId.startsWith(QLatin1String("slowmotion"))) continue;
if (prodId.contains('_')) prodId = prodId.section('_', 0, 0);
if (prodId != id) continue;
if (mltDuration > 0 ) {
......@@ -351,7 +351,7 @@ bool DocumentChecker::hasErrorInClips()
mltProd = documentProducers.at(j).toElement();
QString prodId = mltProd.attribute("id");
bool slowmotion = false;
if (prodId.startsWith("slowmotion")) {
if (prodId.startsWith(QLatin1String("slowmotion"))) {
slowmotion = true;
prodId = prodId.section(':', 1, 1);
}
......
......@@ -838,7 +838,7 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
if (kproducer.attribute("type").toInt() == Text) {
QString data = kproducer.attribute("xmldata");
QString datafile = kproducer.attribute("resource");
if (!datafile.endsWith(".kdenlivetitle")) {
if (!datafile.endsWith(QLatin1String(".kdenlivetitle"))) {
datafile = QString();
kproducer.setAttribute("resource", QString());
}
......
......@@ -287,7 +287,7 @@ KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup
for (int i = 0; i < infomax; ++i) {
e = infoproducers.item(i).cloneNode().toElement();
QString prodId = e.attribute("id");
if (!e.isNull() && prodId != "black" && !prodId.startsWith("slowmotion")) {
if (!e.isNull() && prodId != "black" && !prodId.startsWith(QLatin1String("slowmotion"))) {
e.setTagName("producer");
// Get MLT's original producer properties
QDomElement orig;
......@@ -1252,8 +1252,8 @@ bool KdenliveDoc::addClipInfo(QDomElement elem, QDomElement orig, const QString
QMap<QString, QString> meta;
for (QDomNode m = orig.firstChild(); !m.isNull(); m = m.nextSibling()) {
QString name = m.toElement().attribute("name");
if (name.startsWith("meta.attr")) {
if (name.endsWith(".markup")) name = name.section('.', 0, -2);
if (name.startsWith(QLatin1String("meta.attr"))) {
if (name.endsWith(QLatin1String(".markup"))) name = name.section('.', 0, -2);
meta.insert(name.section('.', 2, -1), m.firstChild().nodeValue());
}
}
......@@ -1509,7 +1509,7 @@ QMap <QString, QString> KdenliveDoc::getRenderProperties() const
QMapIterator<QString, QString> i(m_documentProperties);
while (i.hasNext()) {
i.next();
if (i.key().startsWith("render")) renderProperties.insert(i.key(), i.value());
if (i.key().startsWith(QLatin1String("render"))) renderProperties.insert(i.key(), i.value());
}
return renderProperties;
}
......
......@@ -892,7 +892,7 @@ void DvdWizard::slotBurn()
QAction *action = qobject_cast<QAction *>(sender());
QString exec = action->data().toString();
QStringList args;
if (exec.endsWith("k3b")) args << "--image" << m_status.iso_image->url().path();
if (exec.endsWith(QLatin1String("k3b"))) args << "--image" << m_status.iso_image->url().path();
else args << "--image=" + m_status.iso_image->url().path();
QProcess::startDetached(exec, args);
}
......
......@@ -317,7 +317,7 @@ void EffectsList::removeMetaProperties(QDomElement producer)
QDomNodeList params = producer.elementsByTagName("property");
for (int i = 0; i < params.count(); ++i) {
QDomElement e = params.item(i).toElement();
if (e.attribute("name").startsWith("meta")) {
if (e.attribute("name").startsWith(QLatin1String("meta"))) {
producer.removeChild(params.item(i));
--i;
}
......
......@@ -179,7 +179,7 @@ ParameterContainer::ParameterContainer(const QDomElement &effect, const ItemInfo
for (int i = 0; i < listitems.count(); ++i) {
lsval->list->addItem(listitemsdisplay.at(i), listitems.at(i));
QString entry = listitems.at(i);
if (!entry.isEmpty() && (entry.endsWith(".png") || entry.endsWith(".pgm"))) {
if (!entry.isEmpty() && (entry.endsWith(QLatin1String(".png")) || entry.endsWith(QLatin1String(".pgm")))) {
if (!MainWindow::m_lumacache.contains(entry)) {
QImage pix(entry);
MainWindow::m_lumacache.insert(entry, pix.scaled(30, 30, Qt::KeepAspectRatio, Qt::SmoothTransformation));
......@@ -520,13 +520,13 @@ wipeInfo ParameterContainer::getWipeInfo(QString value)
if (value.contains(',')) value.replace(',','/');
QString start = value.section(';', 0, 0);
QString end = value.section(';', 1, 1).section('=', 1, 1);
if (start.startsWith("-100%/0"))
if (start.startsWith(QLatin1String("-100%/0")))
info.start = LEFT;
else if (start.startsWith("100%/0"))
else if (start.startsWith(QLatin1String("100%/0")))
info.start = RIGHT;
else if (start.startsWith("0%/100%"))
else if (start.startsWith(QLatin1String("0%/100%")))
info.start = DOWN;
else if (start.startsWith("0%/-100%"))
else if (start.startsWith(QLatin1String("0%/-100%")))
info.start = UP;
else
info.start = CENTER;
......@@ -536,13 +536,13 @@ wipeInfo ParameterContainer::getWipeInfo(QString value)
else
info.startTransparency = 100;
if (end.startsWith("-100%/0"))
if (end.startsWith(QLatin1String("-100%/0")))
info.end = LEFT;
else if (end.startsWith("100%/0"))
else if (end.startsWith(QLatin1String("100%/0")))
info.end = RIGHT;
else if (end.startsWith("0%/100%"))
else if (end.startsWith(QLatin1String("0%/100%")))
info.end = DOWN;
else if (end.startsWith("0%/-100%"))
else if (end.startsWith(QLatin1String("0%/-100%")))
info.end = UP;
else
info.end = CENTER;
......
......@@ -34,7 +34,7 @@ static QColor stringToColor(QString strColor)
bool ok = false;
QColor color("black");
int intval = 0;
if (strColor.startsWith("0x")) {
if (strColor.startsWith(QLatin1String("0x"))) {
if (strColor.length() == 10) {
// 0xRRGGBBAA
intval = strColor.toUInt(&ok, 16);
......
......@@ -49,7 +49,7 @@ void initEffectsThumbnailer::run()
{
foreach(const QString & entry, m_list) {
kDebug() << entry;
if (!entry.isEmpty() && (entry.endsWith(".png") || entry.endsWith(".pgm"))) {
if (!entry.isEmpty() && (entry.endsWith(QLatin1String(".png")) || entry.endsWith(QLatin1String(".pgm")))) {
if (!MainWindow::m_lumacache.contains(entry)) {
QImage pix(entry);
//if (!pix.isNull())
......@@ -240,7 +240,7 @@ void initEffects::parseEffectFiles(const QString &locale)
if (doc.elementsByTagName("description").count() > 0) {
QString desc = doc.documentElement().firstChildElement("description").text();
//WARNING: TEMPORARY FIX for unusable MLT SOX parameters description
if (desc.startsWith("Process audio using a SoX")) {
if (desc.startsWith(QLatin1String("Process audio using a SoX"))) {
// Remove MLT's SOX generated effects since the parameters properties are unusable for us
}
else {
......
......@@ -2202,7 +2202,7 @@ void MainWindow::openFile(const KUrl &url)
return;
}
if (!url.fileName().endsWith(".kdenlive")) {
if (!url.fileName().endsWith(QLatin1String(".kdenlive"))) {
// This is not a Kdenlive project file, abort loading
KMessageBox::sorry(this, i18n("File %1 is not a Kdenlive project file", url.path()));
if (!m_startUrl.isEmpty()) {
......@@ -2342,7 +2342,7 @@ void MainWindow::recoverFiles(const QList<KAutoSaveFile *> &staleFiles, const KU
}*/
kDebug() << "// OPENING RECOVERY: " << stale->fileName() << "\nMANAGED: " << stale->managedFile().path();
// the stalefiles also contain ".lock" files so we must ignore them... bug in KAutoSaveFile?
if (!stale->fileName().endsWith(".lock")) {
if (!stale->fileName().endsWith(QLatin1String(".lock"))) {
doOpenFile(originUrl, stale);
} else {
KIO::NetAccess::del(KUrl(stale->fileName()), this);
......@@ -2362,7 +2362,7 @@ void MainWindow::parseProfiles(const QString &mltPath)
KdenliveSettings::setMltpath(QString(MLT_PREFIX) + QString("/share/mlt/profiles/"));
}
if (KdenliveSettings::rendererpath().isEmpty() || KdenliveSettings::rendererpath().endsWith("inigo")) {
if (KdenliveSettings::rendererpath().isEmpty() || KdenliveSettings::rendererpath().endsWith(QLatin1String("inigo"))) {
QString meltPath = QString(MLT_PREFIX) + QString("/bin/melt");
if (!QFile::exists(meltPath)) {
meltPath = KStandardDirs::findExe("melt");
......
......@@ -918,9 +918,9 @@ void ProjectList::adjustTranscodeActions(ProjectItem *clip) const
data = transcodeActions.at(i)->data().toStringList();
if (data.count() > 2) {
condition = data.at(2);
if (condition.startsWith("vcodec"))
if (condition.startsWith(QLatin1String("vcodec")))
transcodeActions.at(i)->setEnabled(clip->referencedClip()->hasVideoCodec(condition.section('=', 1, 1)));
else if (condition.startsWith("acodec"))
else if (condition.startsWith(QLatin1String("acodec")))
transcodeActions.at(i)->setEnabled(clip->referencedClip()->hasVideoCodec(condition.section('=', 1, 1)));
}
}
......@@ -1718,7 +1718,7 @@ void ProjectList::slotAddClip(const QList <QUrl> &givenList, const QString &grou
QString fileName = url.fileName().section('.', 0, -2);
if (fileName.at(fileName.size() - 1).isDigit()) {
KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
if (item.mimetype().startsWith("image")) {
if (item.mimetype().startsWith(QLatin1String("image"))) {
// import as sequence if we found more than one image in the sequence
QStringList list;
QString pattern = SlideshowClip::selectedPath(url.path(), false, QString(), &list);
......@@ -2219,9 +2219,9 @@ void ProjectList::extractMetadata(DocClipBase *clip)
QString res = p.readAllStandardOutput();
QStringList list = res.split("\n");
foreach(QString tagline, list) {
if (tagline.startsWith("-File") || tagline.startsWith("-ExifTool")) continue;
if (tagline.startsWith(QLatin1String("-File")) || tagline.startsWith(QLatin1String("-ExifTool"))) continue;
QString tag = tagline.section(':', 1).simplified();
if (tag.startsWith("ImageWidth") || tag.startsWith("ImageHeight")) continue;
if (tag.startsWith(QLatin1String("ImageWidth")) || tag.startsWith(QLatin1String("ImageHeight"))) continue;
if (!tag.section('=', 0, 0).isEmpty() && !tag.section('=', 1).simplified().isEmpty())
meta.insert(tag.section('=', 0, 0), tag.section('=', 1).simplified());
}
......@@ -2236,9 +2236,9 @@ void ProjectList::extractMetadata(DocClipBase *clip)
QString res = p.readAllStandardOutput();
QStringList list = res.split("\n");
foreach(QString tagline, list) {
if (!tagline.startsWith("-H264")) continue;
if (!tagline.startsWith(QLatin1String("-H264"))) continue;
QString tag = tagline.section(':', 1);
if (tag.startsWith("ImageWidth") || tag.startsWith("ImageHeight")) continue;
if (tag.startsWith(QLatin1String("ImageWidth")) || tag.startsWith(QLatin1String("ImageHeight"))) continue;
meta.insert(tag.section('=', 0, 0), tag.section('=', 1));
}
}
......@@ -2259,7 +2259,7 @@ void ProjectList::extractMetadata(DocClipBase *clip)
while (!file.atEnd()) {
QString line = file.readLine().simplified();
if (line.startsWith('#') || line.isEmpty() || !line.contains(':')) continue;
if (line.startsWith("CSV data")) break;
if (line.startsWith(QLatin1String("CSV data"))) break;
meta.insert(line.section(':', 0, 0).simplified(), line.section(':', 1).simplified());
}
}
......@@ -2617,9 +2617,9 @@ KUrl::List ProjectList::getConditionalUrls(const QString &condition) const
continue;
DocClipBase *clip = item->referencedClip();
if (!condition.isEmpty()) {
if (condition.startsWith("vcodec") && !clip->hasVideoCodec(condition.section('=', 1, 1)))
if (condition.startsWith(QLatin1String("vcodec")) && !clip->hasVideoCodec(condition.section('=', 1, 1)))
continue;
else if (condition.startsWith("acodec") && !clip->hasAudioCodec(condition.section('=', 1, 1)))
else if (condition.startsWith(QLatin1String("acodec")) && !clip->hasAudioCodec(condition.section('=', 1, 1)))
continue;
}
result.append(item->clipUrl());
......@@ -2645,9 +2645,9 @@ QMap <QString, QString> ProjectList::getConditionalIds(const QString &condition)
continue;
DocClipBase *clip = item->referencedClip();
if (!condition.isEmpty()) {
if (condition.startsWith("vcodec") && !clip->hasVideoCodec(condition.section('=', 1, 1)))
if (condition.startsWith(QLatin1String("vcodec")) && !clip->hasVideoCodec(condition.section('=', 1, 1)))
continue;
else if (condition.startsWith("acodec") && !clip->hasAudioCodec(condition.section('=', 1, 1)))
else if (condition.startsWith(QLatin1String("acodec")) && !clip->hasAudioCodec(condition.section('=', 1, 1)))
continue;
}
result.insert(item->clipId(), item->clipUrl().path());
......
......@@ -508,11 +508,11 @@ QStringList ProjectSettings::extractPlaylistUrls(const QString &path)
}
if (!url.isEmpty()) {
if (!url.startsWith('/')) url.prepend(root);
if (url.section('.', 0, -2).endsWith("/.all")) {
if (url.section('.', 0, -2).endsWith(QLatin1String("/.all"))) {
// slideshow clip, extract image urls
urls << extractSlideshowUrls(KUrl(url));
} else urls << url;
if (url.endsWith(".mlt") || url.endsWith(".kdenlive")) {
if (url.endsWith(QLatin1String(".mlt")) || url.endsWith(QLatin1String(".kdenlive"))) {
//TODO: Do something to avoid infinite loops if 2 files reference themselves...
urls << extractPlaylistUrls(url);
}
......
......@@ -510,7 +510,7 @@ QPixmap Render::getImageThumbnail(const KUrl &url, int /*width*/, int /*height*/
{
QImage im;
QPixmap pixmap;
if (url.fileName().startsWith(".all.")) { // check for slideshow
if (url.fileName().startsWith(QLatin1String(".all."))) { // check for slideshow
QString fileType = url.fileName().right(3);
QStringList more;
QDir dir(url.directory());
......@@ -1122,7 +1122,7 @@ void Render::processFileProperties()
for (int i = 0; i < count; i ++) {
QString name = metadata.get_name(i);
QString value = QString::fromUtf8(metadata.get(i));
if (name.endsWith(".markup") && !value.isEmpty())
if (name.endsWith(QLatin1String(".markup")) && !value.isEmpty())
metadataPropertyMap[ name.section('.', 0, -2)] = value;
}
producer->seek(0);
......@@ -3011,7 +3011,7 @@ bool Render::mltEditEffect(int track, const GenTime &position, EffectsParameterL
int index = params.paramValue("kdenlive_ix").toInt();
QString tag = params.paramValue("tag");
if (!params.paramValue("keyframes").isEmpty() || (tag == "affine" && params.hasParam("background")) || tag.startsWith("ladspa") || tag == "sox" || tag == "autotrack_rectangle") {
if (!params.paramValue("keyframes").isEmpty() || (tag == "affine" && params.hasParam("background")) || tag.startsWith(QLatin1String("ladspa")) || tag == "sox" || tag == "autotrack_rectangle") {
// This is a keyframe effect, to edit it, we remove it and re-add it.
if (mltRemoveEffect(track, position, index, false)) {
if (position < GenTime())
......@@ -4147,7 +4147,7 @@ const QList <Mlt::Producer *> Render::producersList()
Mlt::Producer *c = trackPlaylist.get_clip(i);
if (c == NULL) continue;
QString prodId = c->parent().get("id");
if (!c->is_blank() && !ids.contains(prodId) && !prodId.startsWith("slowmotion") && !prodId.isEmpty()) {
if (!c->is_blank() && !ids.contains(prodId) && !prodId.startsWith(QLatin1String("slowmotion")) && !prodId.isEmpty()) {
Mlt::Producer *nprod = new Mlt::Producer(c->get_parent());
if (nprod) {
ids.append(prodId);
......@@ -4181,7 +4181,7 @@ void Render::fillSlowMotionProducers()
Mlt::Producer *nprod = new Mlt::Producer(c->get_parent());
if (nprod) {
QString id = nprod->parent().get("id");
if (id.startsWith("slowmotion:") && !nprod->is_blank()) {
if (id.startsWith(QLatin1String("slowmotion:")) && !nprod->is_blank()) {
// this is a slowmotion producer, add it to the list
QString url = QString::fromUtf8(nprod->get("resource"));
int strobe = nprod->get_int("strobe");
......@@ -4376,7 +4376,7 @@ QString Render::updateSceneListFps(double current_fps, double new_fps, const QSt
for (int j = 0; j < props.count(); j++) {
QDomElement param = props.at(j).toElement();
QString paramName = param.attribute("name");
if (paramName.startsWith("meta.") || paramName == "length") {
if (paramName.startsWith(QLatin1String("meta.")) || paramName == "length") {
prod.removeChild(props.at(j));
j--;
}
......
......@@ -161,7 +161,7 @@ void ColorPlaneExport::slotExportPlane()
#ifdef DEBUG_CPE
qDebug() << "Lower: " << lower;
#endif
if (!lower.endsWith(".png") && !lower.endsWith(".jpg") && !lower.endsWith(".tif") && !lower.endsWith(".tiff")) {
if (!lower.endsWith(QLatin1String(".png")) && !lower.endsWith(QLatin1String(".jpg")) && !lower.endsWith(QLatin1String(".tif")) && !lower.endsWith(QLatin1String(".tiff"))) {
if (KMessageBox::questionYesNo(this, i18n("File has no extension. Add extension (%1)?", EXTENSION_PNG)) == KMessageBox::Yes) {
kurlrequester->setUrl(KUrl(kurlrequester->text() + ".png"));
}
......
......@@ -426,15 +426,15 @@ void SlideshowClip::slotMethodChanged(bool active)
QString SlideshowClip::animationToGeometry(const QString &animation, int &ttl)
{
QString geometry;
if (animation.startsWith("Pan and zoom")) {
if (animation.startsWith(QLatin1String("Pan and zoom"))) {
geometry = QString().sprintf("0=0/0:100%%x100%%;%d=-14%%/-14%%:120%%x120%%;%d=-5%%/-5%%:110%%x110%%;%d=0/0:110%%x110%%;%d=0/-5%%:110%%x110%%;%d=-5%%/0:110%%x110%%",
ttl - 1, ttl, ttl * 2 - 1, ttl * 2, ttl * 3 - 1);
ttl *= 3;
} else if (animation.startsWith("Pan")) {
} else if (animation.startsWith(QLatin1String("Pan"))) {
geometry = QString().sprintf("0=-5%%/-5%%:110%%x110%%;%d=0/0:110%%x110%%;%d=0/0:110%%x110%%;%d=0/-5%%:110%%x110%%;%d=0/-5%%:110%%x110%%;%d=-5%%/-5%%:110%%x110%%;%d=0/-5%%:110%%x110%%;%d=-5%%/0:110%%x110%%",
ttl - 1, ttl, ttl * 2 - 1, ttl * 2, ttl * 3 - 1, ttl * 3, ttl * 4 - 1);
ttl *= 4;
} else if (animation.startsWith("Zoom")) {
} else if (animation.startsWith(QLatin1String("Zoom"))) {
geometry = QString().sprintf("0=0/0:100%%x100%%;%d=-14%%/-14%%:120%%x120%%", ttl - 1);
}
return geometry;
......
......@@ -1997,7 +1997,7 @@ QMap<int, QDomElement> ClipItem::adjustEffectsToDuration(int width, int height,
for (int i = 0; i < m_effectList.count(); ++i) {
QDomElement effect = m_effectList.at(i);
if (effect.attribute("id").startsWith("fade")) {
if (effect.attribute("id").startsWith(QLatin1String("fade"))) {
QString id = effect.attribute("id");
int in = EffectsList::parameter(effect, "in").toInt();
int out = EffectsList::parameter(effect, "out").toInt();
......
......@@ -626,7 +626,7 @@ int TrackView::slotAddProjectTrack(int ix, QDomElement xml, bool locked, const Q
QString id = idString;
double speed = 1.0;
int strobe = 1;
if (idString.startsWith("slowmotion")) {
if (idString.startsWith(QLatin1String("slowmotion"))) {
QLocale locale;
locale.setNumberOptions(QLocale::OmitGroupSeparator);
id = idString.section(':', 1, 1);
......@@ -744,8 +744,8 @@ int TrackView::slotAddProjectTrack(int ix, QDomElement xml, bool locked, const Q
clipinfo.track = ix;
//kDebug() << "// INSERTING CLIP: " << in << 'x' << out << ", track: " << ix << ", ID: " << id << ", SCALE: " << m_scale << ", FPS: " << m_doc->fps();
ClipItem *item = new ClipItem(clip, clipinfo, m_doc->fps(), speed, strobe, frame_width, false);
if (idString.endsWith("_video")) item->setVideoOnly(true);
else if (idString.endsWith("_audio")) item->setAudioOnly(true);
if (idString.endsWith(QLatin1String("_video"))) item->setVideoOnly(true);
else if (idString.endsWith(QLatin1String("_audio"))) item->setAudioOnly(true);
m_scene->addItem(item);
if (locked) item->setItemLocked(true);
clip->addReference();
......@@ -918,7 +918,7 @@ void TrackView::slotAddProjectEffects(QDomNodeList effects, QDomElement parentNo
QString paramname = effectparam.attribute("name");
QString paramvalue = effectparam.text();
if (regionFilter && paramname.startsWith("filter")) {
if (regionFilter && paramname.startsWith(QLatin1String("filter"))) {
regionEffects.insert(paramname, paramvalue);
continue;
}
......@@ -1025,7 +1025,7 @@ DocClipBase *TrackView::getMissingProducer(const QString &id) const
for (int i = 0; i < maxprod; ++i) {
QDomNode m = prods.at(i);
QString prodId = m.toElement().attribute("id");
if (prodId.startsWith("slowmotion")) {
if (prodId.startsWith(QLatin1String("slowmotion"))) {
slowmotionClip = true;
prodId = prodId.section(':', 1, 1);
}
......@@ -1043,7 +1043,7 @@ DocClipBase *TrackView::getMissingProducer(const QString &id) const
for (int i = 0; i < maxprod; ++i) {
QDomNode m = prods.at(i);
QString prodId = m.toElement().attribute("id");
if (prodId.startsWith("slowmotion")) {
if (prodId.startsWith(QLatin1String("slowmotion"))) {
slowmotionClip = true;
prodId = prodId.section(':', 1, 1);
}
......
......@@ -102,7 +102,7 @@ void ArchiveOrg::slotShowResults(KJob* job)
item->setData(idRole, soundmap.value("identifier").toString());
QString author = soundmap.value("creator").toString();
item->setData(authorRole, author);
if (author.startsWith("http")) item->setData(authorUrl, author);
if (author.startsWith(QLatin1String("http"))) item->setData(authorUrl, author);
item->setData(infoUrl, "http://archive.org/details/" + soundmap.value("identifier").toString());
item->setData(downloadRole, "http://archive.org/download/" + soundmap.value("identifier").toString());
item->setData(licenseRole, soundmap.value("licenseurl").toString());
......@@ -164,14 +164,14 @@ void ArchiveOrg::slotParseResults(KJob* job)
m_thumbsPath.clear();
for (int i = 0; i < links.count(); ++i) {
QString href = links.at(i).toElement().attribute("href");
if (href.endsWith(".thumbs/")) {
if (href.endsWith(QLatin1String(".thumbs/"))) {
// sub folder contains image thumbs, display one.
m_thumbsPath = m_metaInfo.value("url") + '/' + href;
KJob* thumbJob = KIO::storedGet( KUrl(m_thumbsPath), KIO::NoReload, KIO::HideProgressInfo );
thumbJob->setProperty("id", m_metaInfo.value("id"));
connect( thumbJob, SIGNAL(result(KJob*)), this, SLOT(slotParseThumbs(KJob*)) );
}
else if (!href.contains('/') && !href.endsWith(".xml")) {
else if (!href.contains('/') && !href.endsWith(QLatin1String(".xml"))) {
link = m_metaInfo.value("url") + '/' + href;
ct++;
if (ct %2 == 0) {
......
......@@ -397,7 +397,7 @@ void ResourceWidget::parseLicense(const QString &licenseUrl)
licenseName = "Attribution-NonCommercial-NoDerivs";
else if (licenseUrl.contains("/publicdomain/zero/"))
licenseName = "Creative Commons 0";
else if (licenseUrl.endsWith("/publicdomain"))
else if (licenseUrl.endsWith(QLatin1String("/publicdomain")))
licenseName = "Public Domain";
else licenseName = i18n("Unknown");
item_license->setText(licenseName);
......@@ -408,7 +408,7 @@ void ResourceWidget::parseLicense(const QString &licenseUrl)
void ResourceWidget::slotOpenLink(const QUrl &url)
{
QString path = url.toEncoded();
if (path.endsWith("_import")) {
if (path.endsWith(QLatin1String("_import"))) {
path.chop(7);
// import file in Kdenlive
slotSaveItem(path);
......
......@@ -282,7 +282,7 @@ void ArchiveWidget::openArchiveForExtraction()
bool isProjectArchive = false;
QStringList files = m_extractArchive->directory()->entries();
for (int i = 0; i < files.count(); ++i) {
if (files.at(i).endsWith(".kdenlive")) {
if (files.at(i).endsWith(QLatin1String(".kdenlive"))) {
m_projectName = files.at(i);
isProjectArchive = true;
break;
......@@ -340,7 +340,7 @@ void ArchiveWidget::generateItems(QTreeWidgetItem *parentItem, const QStringList
ix++;
KUrl slideUrl(file);
QDir dir(slideUrl.directory(KUrl::AppendTrailingSlash));
if (slideUrl.fileName().startsWith(".all.")) {
if (slideUrl.fileName().startsWith(QLatin1String(".all."))) {
// mimetype slideshow (for example *.png)
QStringList filters;
// TODO: improve jpeg image detection with extension like jpeg, requires change in MLT image producers
......@@ -425,7 +425,7 @@ void ArchiveWidget::generateItems(QTreeWidgetItem *parentItem, const QMap <QStri
ix++;
KUrl slideUrl(file);
QDir dir(slideUrl.directory(KUrl::AppendTrailingSlash));
if (slideUrl.fileName().startsWith(".all.")) {
if (slideUrl.fileName().startsWith(QLatin1String(".all."))) {
// mimetype slideshow (for example *.png)
QStringList filters;
// TODO: improve jpeg image detection with extension like jpeg, requires change in MLT image producers
......
......@@ -754,7 +754,7 @@ void RenderWidget::slotDeleteProfile(bool refresh)
//TODO: delete a profile installed by KNewStuff the easy way
/*
QString edit = m_view.size_list->currentItem()->data(EditableRole).toString();
if (!edit.endsWith("customprofiles.xml")) {
if (!edit.endsWith(QLatin1String("customprofiles.xml"))) {
// This is a KNewStuff installed file, process through KNS
KNS::Engine engine(0);
if (engine.init("kdenlive_render.knsrc")) {
......@@ -824,7 +824,7 @@ void RenderWidget::updateButtons()
m_view.buttonRender->setEnabled(m_view.size_list->currentItem()->toolTip().isEmpty());
m_view.buttonGenerateScript->setEnabled(m_view.size_list->currentItem()->toolTip().isEmpty());
QString edit = m_view.size_list->currentItem()->data(EditableRole).toString();
if (edit.isEmpty() || !edit.endsWith("customprofiles.xml")) {
if (edit.isEmpty() || !edit.endsWith(QLatin1String("customprofiles.xml"))) {
m_view.buttonDelete->setEnabled(false);
m_view.buttonEdit->setEnabled(false);
} else {
......@@ -981,7 +981,7 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, const
QString destination = m_view.destination_list->itemData(m_view.destination_list->currentIndex()).toString();
const QString currentSize = QString::number(width) + 'x' + QString::number(height);
QString subsize = currentSize;
if (std.startsWith("s=")) {
if (std.startsWith(QLatin1String("s="))) {
subsize = std.section(' ', 0, 0).toLower();
subsize = subsize.section('=', 1, 1);
} else if (std.contains(" s=")) {
......@@ -1337,7 +1337,7 @@ void RenderWidget::refreshView(const QString &profile)
// Make sure the selected profile uses an installed avformat codec / format
if (!formatsList.isEmpty()) {
QString format;
if (std.startsWith("f=")) format = std.section("f=", 1, 1);
if (std.startsWith(QLatin1String("f="))) format = std.section("f=", 1, 1);
else if (std.contains(" f=")) format = std.section(" f=", 1, 1);
if (!format.isEmpty()) {
format = format.section(' ', 0, 0).toLower();
......@@ -1353,7 +1353,7 @@ void RenderWidget::refreshView(const QString &profile)
}
if (!acodecsList.isEmpty()) {
QString format;
if (std.startsWith("acodec=")) format = std.section("acodec=", 1, 1);
if (std.startsWith(QLatin1String("acodec="))) format = std.section("acodec=", 1, 1);
else if (std.contains(" acodec=")) format = std.section(" acodec=", 1, 1);
if (!format.isEmpty()) {
format = format.section(' ', 0, 0).toLower();
......@@ -1370,7 +1370,7 @@ void RenderWidget::refreshView(const QString &profile)
}
if (!vcodecsList.isEmpty()) {
QString format;
if (std.startsWith("vcodec=")) format = std.section("vcodec=", 1, 1);
if (std.startsWith(QLatin1String("vcodec="))) format = std.section("vcodec=", 1, 1);
else if (std.contains(" vcodec=")) format = std.section(" vcodec=", 1, 1);
if (!format.isEmpty()) {
format = format.section(' ', 0, 0).toLower();
......@@ -1384,7 +1384,7 @@ void RenderWidget::refreshView(const QString &profile)
}
}
}
if (std.contains(" profile=") || std.startsWith("profile=")) {
if (std.contains(" profile=") || std.startsWith(QLatin1String("profile="))) {
// changed in MLT commit d8a3a5c9190646aae72048f71a39ee7446a3bd45
// (http://www.mltframework.org/gitweb/mlt.git?p=mltframework.org/mlt.git;a=commit;h=d8a3a5c9190646aae72048f71a39ee7446a3bd45)
dupItem->setToolTip(i18n("This render profile uses a 'profile' parameter.<br />Unless you know what you are doing you will probably have to change it to 'mlt_profile'."));
......@@ -1445,7 +1445,7 @@ void RenderWidget::refreshParams()
QString extension = item->data(ExtensionRole).toString();
m_view.advanced_params->setPlainText(params);
QString destination = m_view.destination_list->itemData(m_view.destination_list->currentIndex()).toString();
if (params.contains(" s=") || params.startsWith("s=") || destination == "audioonly") {
if (params.contains(" s=") || params.startsWith(QLatin1String("s=")) || destination == "audioonly") {
// profile has a fixed size, do not allow resize
m_view.rescale->setEnabled(false);
setRescaleEnabled(false);
......@@ -1466,7 +1466,7 @@ void RenderWidget::refreshParams()
// }
m_view.out_file->setFilter("*." + extension);
QString edit = item->data(EditableRole).toString();
if (edit.isEmpty() || !edit.endsWith("customprofiles.xml")) {
if (edit.isEmpty() || !edit.endsWith(QLatin1String("customprofiles.xml"))) {
m_view.buttonDelete->setEnabled(false);
m_view.buttonEdit->setEnabled(false);
} else {
......@@ -1681,7 +1681,7 @@ void RenderWidget::parseFile(const QString &exportFile, bool editable)
if (profile.hasAttribute("url")) item->setData(ExtraRole, profile.attribute("url"));
if (editable) {
item->setData(EditableRole, exportFile);
if (exportFile.endsWith("customprofiles.xml")) item->setIcon(KIcon("emblem-favorite"));
if (exportFile.endsWith(QLatin1String("customprofiles.xml"))) item->setIcon(KIcon("emblem-favorite"));
else item->setIcon(KIcon("applications-internet"));