]> git.sesse.net Git - kdenlive/commitdiff
Fix saved effect groups not showing in effects list
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 12 Apr 2012 23:02:30 +0000 (01:02 +0200)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 12 Apr 2012 23:02:30 +0000 (01:02 +0200)
src/effectslistwidget.cpp
src/effectslistwidget.h
src/initeffects.cpp

index 96ab4c1507377e6672a032b61562a7d5777e8cc6..44a066b1569defbd0c9f1fbe1ed3cacf221fdb1e 100644 (file)
@@ -146,9 +146,9 @@ void EffectsListWidget::initList(QMenu *effectsMenu, KActionCategory *effectActi
 
     //insertTopLevelItems(0, folders);
 
-    loadEffects(&MainWindow::videoEffects, KIcon("kdenlive-show-video"), misc, &folders, QString::number((int) EFFECT_VIDEO), current, &found);
-    loadEffects(&MainWindow::audioEffects, KIcon("kdenlive-show-audio"), audio, &folders, QString::number((int) EFFECT_AUDIO), current, &found);
-    loadEffects(&MainWindow::customEffects, KIcon("kdenlive-custom-effect"), custom, static_cast<QList<QTreeWidgetItem *> *>(0), QString::number((int) EFFECT_CUSTOM), current, &found);
+    loadEffects(&MainWindow::videoEffects, KIcon("kdenlive-show-video"), misc, &folders, EFFECT_VIDEO, current, &found);
+    loadEffects(&MainWindow::audioEffects, KIcon("kdenlive-show-audio"), audio, &folders, EFFECT_AUDIO, current, &found);
+    loadEffects(&MainWindow::customEffects, KIcon("kdenlive-custom-effect"), custom, static_cast<QList<QTreeWidgetItem *> *>(0), EFFECT_CUSTOM, current, &found);
 
     if (!found && !currentFolder.isEmpty()) {
         // previously selected effect was removed, focus on its parent folder
@@ -220,16 +220,17 @@ void EffectsListWidget::initList(QMenu *effectsMenu, KActionCategory *effectActi
     }
 }
 
-void EffectsListWidget::loadEffects(const EffectsList *effectlist, KIcon icon, QTreeWidgetItem *defaultFolder, const QList<QTreeWidgetItem *> *folders, const QString type, const QString current, bool *found)
+void EffectsListWidget::loadEffects(const EffectsList *effectlist, KIcon icon, QTreeWidgetItem *defaultFolder, const QList<QTreeWidgetItem *> *folders, int type, const QString current, bool *found)
 {
     QStringList effectInfo, l;
     QTreeWidgetItem *parentItem;
     QTreeWidgetItem *item;
     int ct = effectlist->count();
 
+    
     for (int ix = 0; ix < ct; ix ++) {
         effectInfo = effectlist->effectIdInfo(ix);
-        effectInfo.append(type);
+        effectInfo.append(QString::number(type));
         parentItem = NULL;
 
         if (folders) {
index 3828884671f23d653c0493bcf9adaac9f09ce183..0e6ba5b80da5fd45ef9f7db73bc46e14d430f091 100644 (file)
@@ -61,7 +61,7 @@ private:
      * @param current name of selected effect before reload; if an effect name matches this one it will become selected
      * @param found will be set to true if an effect name matches current
      */
-    void loadEffects(const EffectsList *effectlist, KIcon icon, QTreeWidgetItem *defaultFolder, const QList<QTreeWidgetItem *> *folders, const QString type, const QString current, bool *found);
+    void loadEffects(const EffectsList *effectlist, KIcon icon, QTreeWidgetItem *defaultFolder, const QList<QTreeWidgetItem *> *folders, int type, const QString current, bool *found);
 
 private slots:
     void slotExpandItem(const QModelIndex & index);
index 6f0608fa47ff85c1c623dd714e40846346315984..a145f4c15c155aa751b5402fd7b6208a0324e9c9 100644 (file)
@@ -268,7 +268,10 @@ void initEffects::parseEffectFiles()
     max = MainWindow::customEffects.count();
     for (int i = 0; i < max; ++i) {
         effectInfo = MainWindow::customEffects.at(i);
-        effectsMap.insert(effectInfo.firstChildElement("name").text().toLower().toUtf8().data(), effectInfo);
+       if (effectInfo.tagName() == "effectgroup") {
+           effectsMap.insert(effectInfo.attribute("name").toLower().toUtf8().data(), effectInfo);
+       }
+        else effectsMap.insert(effectInfo.firstChildElement("name").text().toLower().toUtf8().data(), effectInfo);
     }
     MainWindow::customEffects.clearList();
     foreach(const QDomElement & effect, effectsMap)
@@ -426,11 +429,11 @@ void initEffects::parseEffectFile(EffectsList *customEffectList, EffectsList *au
     if (base.tagName() == "effectgroup") {
        QString type = base.attribute("type", QString());
         if (type == "audio")
-                audioEffectList->append(base);
-            else if (type == "custom")
-                customEffectList->append(base);
-            else
-                videoEffectList->append(base);
+            audioEffectList->append(base);
+        else if (type == "custom")
+           customEffectList->append(base);
+        else
+           videoEffectList->append(base);
     }
 }