[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdenlive] src: Use isEmpty() => optimization
From: Montel Laurent <montel () kde ! org>
Date: 2016-12-03 17:46:37
Message-ID: E1cDEOT-0002Kn-Rd () code ! kde ! org
[Download RAW message or body]
Git commit 9f46cd434e47722b74101c04ce16f533cf0ec34b by Montel Laurent.
Committed on 03/12/2016 at 17:46.
Pushed by mlaurent into branch 'master'.
Use isEmpty() => optimization
M +1 -1 src/bin/bin.cpp
M +1 -1 src/dialogs/renderwidget.cpp
M +3 -3 src/doc/documentchecker.cpp
M +1 -1 src/doc/kdenlivedoc.cpp
M +1 -1 src/dvdwizard/dvdwizardmenu.cpp
M +1 -1 src/effectstack/widgets/keyframeimport.cpp
M +1 -1 src/mainwindow.cpp
M +1 -1 src/project/cliptranscode.cpp
M +2 -2 src/timeline/customtrackview.cpp
https://commits.kde.org/kdenlive/9f46cd434e47722b74101c04ce16f533cf0ec34b
diff --git a/src/bin/bin.cpp b/src/bin/bin.cpp
index 73cecda..73492b8 100644
--- a/src/bin/bin.cpp
+++ b/src/bin/bin.cpp
@@ -2545,7 +2545,7 @@ void Bin::slotItemDropped(const QList<QUrl>&urls, const \
QModelIndex &parent) foreach(const QString & path, result) {
folderFiles.append(QUrl::fromLocalFile(dir.absoluteFilePath(path)));
}
- if (folderFiles.count() > 0) {
+ if (!folderFiles.isEmpty()) {
QString folderId = slotAddFolder(dir.dirName());
QModelIndex ind = getIndexForId(folderId, true);
QStringList newFolderInfo;
diff --git a/src/dialogs/renderwidget.cpp b/src/dialogs/renderwidget.cpp
index f2928dc..cf7b0f2 100644
--- a/src/dialogs/renderwidget.cpp
+++ b/src/dialogs/renderwidget.cpp
@@ -1000,7 +1000,7 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, \
int zoneOut, // script file
QFile file(scriptPath);
int stemCount = playlistPaths.count();
- bool stemExport = (trackNames.count() > 0);
+ bool stemExport = (!trackNames.isEmpty());
for (int stemIdx = 0; stemIdx < stemCount; stemIdx++) {
QString dest(destBase);
diff --git a/src/doc/documentchecker.cpp b/src/doc/documentchecker.cpp
index 5f6d821..e521db8 100644
--- a/src/doc/documentchecker.cpp
+++ b/src/doc/documentchecker.cpp
@@ -365,14 +365,14 @@ bool DocumentChecker::hasErrorInClips()
item->setData(0, typeRole, CLIPMISSING);
}
- if (m_missingClips.count() > 0) {
+ if (!m_missingClips.isEmpty()) {
m_ui.infoLabel->setText(i18n("The project file contains missing clips or \
files")); }
- if (missingProxies.count() > 0) {
+ 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() + i18n("Missing proxies will \
be recreated after opening.")); }
- if (missingSources.count() > 0) {
+ 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() + 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())); }
diff --git a/src/doc/kdenlivedoc.cpp b/src/doc/kdenlivedoc.cpp
index 4ed3ffa..3357453 100644
--- a/src/doc/kdenlivedoc.cpp
+++ b/src/doc/kdenlivedoc.cpp
@@ -648,7 +648,7 @@ QDomDocument KdenliveDoc::xmlSceneList(const QString &scene)
}
//TODO: find a way to process this before rendering MLT scenelist to xml
QDomDocument customeffects = initEffects::getUsedCustomEffects(effectIds);
- if (customeffects.documentElement().childNodes().count() > 0) {
+ if (!customeffects.documentElement().childNodes().isEmpty()) {
EffectsList::setProperty(mainPlaylist, QStringLiteral("kdenlive:customeffects"), \
customeffects.toString()); }
//addedXml.appendChild(sceneList.importNode(customeffects.documentElement(), \
true));
diff --git a/src/dvdwizard/dvdwizardmenu.cpp b/src/dvdwizard/dvdwizardmenu.cpp
index 1fe6730..f89f7f3 100644
--- a/src/dvdwizard/dvdwizardmenu.cpp
+++ b/src/dvdwizard/dvdwizardmenu.cpp
@@ -804,7 +804,7 @@ void DvdWizardMenu::loadXml(DVDFORMAT format, const QDomElement \
&xml)
QDomNodeList buttons = xml.elementsByTagName(QStringLiteral("button"));
//qCDebug(KDENLIVE_LOG) << "// LOADING MENU 2" << buttons.count();
- if (buttons.count() > 0) {
+ if (!buttons.isEmpty()) {
// Clear existing buttons
foreach (QGraphicsItem *item, m_scene->items()) {
if (item->type() == DvdButtonItem) {
diff --git a/src/effectstack/widgets/keyframeimport.cpp \
b/src/effectstack/widgets/keyframeimport.cpp index b136074..bb0d990 100644
--- a/src/effectstack/widgets/keyframeimport.cpp
+++ b/src/effectstack/widgets/keyframeimport.cpp
@@ -333,7 +333,7 @@ void KeyframeImport::updateDisplay()
int selectedtarget = m_sourceCombo->currentData().toInt();
int profileWidth = m_profile.profileSize.width();
int profileHeight = m_profile.profileSize.height();
- if (m_maximas.count() > 0) {
+ if (!m_maximas.isEmpty()) {
if (m_maximas.at(0).x() == m_maximas.at(0).y() || (selectedtarget < 10 && \
selectedtarget != 0)) { maximas << QPoint();
} else {
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 6ab93e9..e31173f 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -3335,7 +3335,7 @@ void MainWindow::slotPrepareRendering(bool scriptExport, bool \
zoneOnly, const QS }
}
- if (chapters.childNodes().count() > 0) {
+ if (!chapters.childNodes().isEmpty()) {
if (pCore->projectManager()->currentTimeline()->projectView()->hasGuide(out, \
true) == -1) { // Always insert a guide in pos 0
QDomElement chapter = doc.createElement(QStringLiteral("chapter"));
diff --git a/src/project/cliptranscode.cpp b/src/project/cliptranscode.cpp
index 495056b..fd2f79b 100644
--- a/src/project/cliptranscode.cpp
+++ b/src/project/cliptranscode.cpp
@@ -126,7 +126,7 @@ void ClipTranscode::slotStartTransCode()
source_url->setUrl(QUrl::fromLocalFile(m_urls.takeFirst()));
destination = dest_url->url().path() + QDir::separator() + \
source_url->url().fileName();
QList<QListWidgetItem *> matching = \
urls_list->findItems(source_url->url().path(), Qt::MatchExactly);
- if (matching.count() > 0) {
+ if (!matching.isEmpty()) {
matching.at(0)->setFlags(Qt::ItemIsSelectable);
urls_list->setCurrentItem(matching.at(0));
}
diff --git a/src/timeline/customtrackview.cpp b/src/timeline/customtrackview.cpp
index 4fc8e9e..da417b9 100644
--- a/src/timeline/customtrackview.cpp
+++ b/src/timeline/customtrackview.cpp
@@ -4231,7 +4231,7 @@ void CustomTrackView::deleteSelectedClips()
}
}
itemList += children;
- if (clipInfos.count() > 0)
+ if (!clipInfos.isEmpty())
new GroupClipsCommand(this, clipInfos, transitionInfos, false, true, \
deleteSelected);
} else if (itemList.at(i)->parentItem() && \
itemList.at(i)->parentItem()->type() == GroupWidget) @@ -4420,7 +4420,7 @@ void \
CustomTrackView::groupClips(bool group, QList<QGraphicsItem *> \
itemList, bo
if (forceLock || !clip->isItemLocked()) \
transitionInfos.append(clip->info()); }
}
- if (clipInfos.count() > 0) {
+ if (!clipInfos.isEmpty()) {
// break previous groups
QUndoCommand *metaCommand = Q_NULLPTR;
if (group && !command && !existingGroups.isEmpty()) {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic