+ QTreeWidgetItem *custom = findFolder(i18nc("Folder Name", "Custom"));
+ if (custom == NULL) {
+ custom = new QTreeWidgetItem((QTreeWidget*)0, QStringList(i18nc("Folder Name", "Custom")));
+ custom->setData(0, TypeRole, QString::number((int) EFFECT_FOLDER));
+ custom->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+ insertTopLevelItem(0, custom);
+ }
+
+ //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);
+
+ if (!found && !currentFolder.isEmpty()) {
+ // previously selected effect was removed, focus on its parent folder
+ for (int i = 0; i < topLevelItemCount(); i++) {
+ if (topLevelItem(i)->text(0) == currentFolder) {
+ setCurrentItem(topLevelItem(i));
+ break;
+ }
+ }
+
+ }
+ setSortingEnabled(true);
+ sortByColumn(0, Qt::AscendingOrder);
+
+ // populate effects menu
+ for (int i = 0; i < topLevelItemCount(); i++) {
+ if (!topLevelItem(i)->childCount())
+ continue;
+ QMenu *sub = new QMenu(topLevelItem(i)->text(0), effectsMenu);
+ effectsMenu->addMenu(sub);
+ for (int j = 0; j < topLevelItem(i)->childCount(); j++) {
+ QTreeWidgetItem *item = topLevelItem(i)->child(j);
+ KAction *a = new KAction(KIcon(item->icon(0)), item->text(0), sub);
+ QStringList data = item->data(0, IdRole).toStringList();
+ QString id = data.at(1);
+ if (id.isEmpty()) id = data.at(0);
+ a->setData(data);
+ a->setIconVisibleInMenu(false);
+ sub->addAction(a);
+ effectActions->addAction("video_effect_" + id, a);
+ }