]> git.sesse.net Git - kdenlive/commitdiff
const'ref. Fix coding style. Minor optimization
authorMontel Laurent <montel@kde.org>
Sun, 2 Jun 2013 08:04:50 +0000 (10:04 +0200)
committerMontel Laurent <montel@kde.org>
Sun, 2 Jun 2013 08:04:50 +0000 (10:04 +0200)
src/dvdwizardmenu.h
src/dvdwizardvob.cpp
src/dvdwizardvob.h
src/effectslist.cpp

index c4496b2f2411296f175c311a84a2e137a473430d..d5daa98964c699b99d8c08a06b92e6db63cfa4da 100644 (file)
@@ -136,7 +136,8 @@ protected:
             list.removeAll(this);
             if (!list.isEmpty()) {
                 for (int i = 0; i < list.count(); ++i) {
-                    if (list.at(i)->type() == Type) return pos();
+                    if (list.at(i)->type() == Type)
+                        return pos();
                 }
             }
             return newPos;
index 6bc64d2b6d7426238db5255d59f08941d1ac7aa3..76e87920b56b130f2cd58ebf2141636357f21af0 100644 (file)
@@ -364,7 +364,7 @@ QStringList DvdWizardVob::chapters() const
     return result;
 }
 
-void DvdWizardVob::updateChapters(QMap <QString, QString> chaptersdata)
+void DvdWizardVob::updateChapters(const QMap <QString, QString> &chaptersdata)
 {
     int max = m_vobList->topLevelItemCount();
     int i = 0;
@@ -374,7 +374,8 @@ void DvdWizardVob::updateChapters(QMap <QString, QString> chaptersdata)
     }
     for (; i < max; ++i) {
         QTreeWidgetItem *item = m_vobList->topLevelItem(i);
-        if (chaptersdata.contains(item->text(0))) item->setData(1, Qt::UserRole + 1, chaptersdata.value(item->text(0)));
+        if (chaptersdata.contains(item->text(0)))
+            item->setData(1, Qt::UserRole + 1, chaptersdata.value(item->text(0)));
     }
 }
 
@@ -391,7 +392,8 @@ int DvdWizardVob::duration(int ix) const
 const QString DvdWizardVob::introMovie() const
 {
     QString url;
-    if (m_view.use_intro->isChecked() && m_vobList->topLevelItemCount() > 0) url = m_vobList->topLevelItem(0)->text(0);
+    if (m_view.use_intro->isChecked() && m_vobList->topLevelItemCount() > 0)
+        url = m_vobList->topLevelItem(0)->text(0);
     return url;
 }
 
@@ -416,7 +418,8 @@ void DvdWizardVob::slotCheckVobList()
     qint64 totalSize = 0;
     for (int i = 0; i < max; ++i) {
         item = m_vobList->topLevelItem(i);
-        if (item) totalSize += (qint64) item->data(2, Qt::UserRole).toInt();
+        if (item)
+            totalSize += (qint64) item->data(2, Qt::UserRole).toInt();
     }
 
     qint64 maxSize = (qint64) 47000 * 100000;
@@ -437,9 +440,11 @@ void DvdWizardVob::slotItemDown()
 {
     int max = m_vobList->topLevelItemCount();
     QTreeWidgetItem *item = m_vobList->currentItem();
-    if (item == NULL) return;
+    if (item == NULL)
+        return;
     int index = m_vobList->indexOfTopLevelItem(item);
-    if (index == max - 1) return;
+    if (index == max - 1)
+        return;
     m_vobList->insertTopLevelItem(index + 1, m_vobList->takeTopLevelItem(index));
 }
 
@@ -489,10 +494,14 @@ QString DvdWizardVob::getDvdProfile(DVDFORMAT format)
 
 void DvdWizardVob::setProfile(const QString& profile)
 {
-    if (profile == "dv_pal_wide") m_view.dvd_profile->setCurrentIndex(PAL_WIDE);
-    else if (profile == "dv_ntsc") m_view.dvd_profile->setCurrentIndex(NTSC);
-    else if (profile == "dv_ntsc_wide") m_view.dvd_profile->setCurrentIndex(NTSC_WIDE);
-    else m_view.dvd_profile->setCurrentIndex(PAL);
+    if (profile == "dv_pal_wide")
+        m_view.dvd_profile->setCurrentIndex(PAL_WIDE);
+    else if (profile == "dv_ntsc")
+        m_view.dvd_profile->setCurrentIndex(NTSC);
+    else if (profile == "dv_ntsc_wide")
+        m_view.dvd_profile->setCurrentIndex(NTSC_WIDE);
+    else
+        m_view.dvd_profile->setCurrentIndex(PAL);
 }
 
 void DvdWizardVob::clear()
index 1b73608c4f7f880740bc3cf6aa7213576888f5c0..64d76e2ae4feb650c43d6dc897ebac0697f73d13 100644 (file)
@@ -47,10 +47,10 @@ public:
     explicit DvdTreeWidget(QWidget *parent);
 
 protected:
-    virtual void dragEnterEvent(QDragEnterEvent * event );
-    virtual void dropEvent(QDropEvent * event );
-    virtual void mouseDoubleClickEvent( QMouseEvent * );
-    virtual void dragMoveEvent(QDragMoveEvent * event);
+    void dragEnterEvent(QDragEnterEvent * event );
+    void dropEvent(QDropEvent * event );
+    void mouseDoubleClickEvent( QMouseEvent * );
+    void dragMoveEvent(QDragMoveEvent * event);
 
 signals:
     void addNewClip();
@@ -92,7 +92,9 @@ public:
             QRectF bounding;
             painter->drawText(r2, Qt::AlignLeft | Qt::AlignVCenter , subText, &bounding);
             painter->restore();
-        } else QStyledItemDelegate::paint(painter, option, index);
+        } else {
+            QStyledItemDelegate::paint(painter, option, index);
+        }
     }
 };
 
@@ -116,7 +118,7 @@ public:
     void clear();
     const QString introMovie() const;
     void setUseIntroMovie(bool use);
-    void updateChapters(QMap <QString, QString> chaptersdata);
+    void updateChapters(const QMap<QString, QString> &chaptersdata);
     static QString getDvdProfile(DVDFORMAT format);
 
 private:
index 2d81f00d586144d537db572f23ace09d238d678e..0588f0ae8de483b85edae350930a8ed345967e1a 100644 (file)
@@ -59,9 +59,9 @@ void EffectsList::initEffect(const QDomElement &effect) const
 {
     QDomNodeList params = effect.elementsByTagName("parameter");
     for (int i = 0; i < params.count(); ++i) {
-       QDomElement e = params.item(i).toElement();
-       if (!e.hasAttribute("value"))
-           e.setAttribute("value", e.attribute("default"));
+        QDomElement e = params.item(i).toElement();
+        if (!e.hasAttribute("value"))
+            e.setAttribute("value", e.attribute("default"));
     }
 }
 
@@ -72,15 +72,15 @@ QDomElement EffectsList::getEffectByTag(const QString & tag, const QString & id)
         QDomElement effect =  effects.at(i).toElement();
         if (!id.isEmpty()) {
             if (effect.attribute("id") == id) {
-               if (effect.tagName() == "effectgroup") {
-                   // Effect group
-                   QDomNodeList subeffects = effect.elementsByTagName("effect");
-                   for (int j = 0; j < subeffects.count(); j++) {
-                       QDomElement sub = subeffects.at(j).toElement();
-                       initEffect(sub);
-                   }
-               }
-               else initEffect(effect);
+                if (effect.tagName() == "effectgroup") {
+                    // Effect group
+                    QDomNodeList subeffects = effect.elementsByTagName("effect");
+                    for (int j = 0; j < subeffects.count(); j++) {
+                        QDomElement sub = subeffects.at(j).toElement();
+                        initEffect(sub);
+                    }
+                }
+                else initEffect(effect);
                 return effect;
             }
         } else if (!tag.isEmpty()) {
@@ -100,7 +100,9 @@ int EffectsList::hasEffect(const QString & tag, const QString & id) const
         QDomElement effect =  effects.at(i).toElement();
         if (!id.isEmpty()) {
             if (effect.attribute("id") == id) return effect.attribute("kdenlive_ix").toInt();
-        } else if (!tag.isEmpty() && effect.attribute("tag") == tag) return effect.attribute("kdenlive_ix").toInt();
+        } else if (!tag.isEmpty() && effect.attribute("tag") == tag) {
+            return effect.attribute("kdenlive_ix").toInt();
+        }
     }
     return -1;
 }
@@ -110,12 +112,12 @@ QStringList EffectsList::effectIdInfo(const int ix) const
     QStringList info;
     QDomElement effect = m_baseElement.childNodes().at(ix).toElement();
     if (effect.tagName() == "effectgroup") {
-       QString groupName = effect.attribute("name");
-       info << groupName << groupName << effect.attribute("id") << QString::number(Kdenlive::groupEffect);
+        QString groupName = effect.attribute("name");
+        info << groupName << groupName << effect.attribute("id") << QString::number(Kdenlive::groupEffect);
     }
     else {
-       QDomElement namenode = effect.firstChildElement("name");
-       info << i18n(namenode.text().toUtf8().data()) << effect.attribute("tag") << effect.attribute("id");
+        QDomElement namenode = effect.firstChildElement("name");
+        info << i18n(namenode.text().toUtf8().data()) << effect.attribute("tag") << effect.attribute("id");
     }
     return info;
 }
@@ -217,18 +219,18 @@ void EffectsList::setParameter(QDomElement effect, const QString &name, const QS
         QDomElement e = params.item(i).toElement();
         if (e.attribute("name") == name) {
             e.setAttribute("value", value);
-           found = true;
+            found = true;
             break;
         }
     }
     if (!found) {
-       // create property
-       QDomDocument doc = effect.ownerDocument();
-       QDomElement e = doc.createElement("parameter");
-       e.setAttribute("name", name);
-       QDomText val = doc.createTextNode(value);
-       e.appendChild(val);
-       effect.appendChild(e);
+        // create property
+        QDomDocument doc = effect.ownerDocument();
+        QDomElement e = doc.createElement("parameter");
+        e.setAttribute("name", name);
+        QDomText val = doc.createTextNode(value);
+        e.appendChild(val);
+        effect.appendChild(e);
     }
 }
 
@@ -255,18 +257,18 @@ void EffectsList::setProperty(QDomElement effect, const QString &name, const QSt
         QDomElement e = params.item(i).toElement();
         if (e.attribute("name") == name) {
             e.firstChild().setNodeValue(value);
-           found = true;
+            found = true;
             break;
         }
     }
     if (!found) {
-       // create property
-       QDomDocument doc = effect.ownerDocument();
-       QDomElement e = doc.createElement("property");
-       e.setAttribute("name", name);
-       QDomText val = doc.createTextNode(value);
-       e.appendChild(val);
-       effect.appendChild(e);
+        // create property
+        QDomDocument doc = effect.ownerDocument();
+        QDomElement e = doc.createElement("property");
+        e.setAttribute("name", name);
+        QDomText val = doc.createTextNode(value);
+        e.appendChild(val);
+        effect.appendChild(e);
     }
 }
 
@@ -327,10 +329,10 @@ QDomElement EffectsList::append(QDomElement e)
 {
     QDomElement result;
     if (!e.isNull()) {
-       result = m_baseElement.appendChild(importNode(e, true)).toElement();
-       if (m_useIndex) {
-           updateIndexes(m_baseElement.childNodes(), m_baseElement.childNodes().count() - 1);
-       }
+        result = m_baseElement.appendChild(importNode(e, true)).toElement();
+        if (m_useIndex) {
+            updateIndexes(m_baseElement.childNodes(), m_baseElement.childNodes().count() - 1);
+        }
     }
     return result;
 }