+
+ //insertTopLevelItems(0, folders);
+
+
+ int ct = MainWindow::videoEffects.count();
+ for (int ix = 0; ix < ct; ix ++) {
+ effectInfo = MainWindow::videoEffects.effectIdInfo(ix);
+ parentItem = NULL;
+ for (int i = 0; i < folders.count(); i++) {
+ QStringList l = folders.at(i)->data(0, IdRole).toString().split(',', QString::SkipEmptyParts);
+ if (l.contains(effectInfo.at(2))) {
+ parentItem = folders.at(i);
+ break;
+ }
+ }
+ if (parentItem == NULL) parentItem = misc;
+ if (!effectInfo.isEmpty()) {
+ item = new QTreeWidgetItem(parentItem, QStringList(effectInfo.takeFirst()));
+ item->setIcon(0, videoIcon);
+ item->setData(0, TypeRole, QString::number((int) EFFECT_VIDEO));
+ item->setData(0, IdRole, effectInfo);
+ if (item->text(0) == current) {
+ setCurrentItem(item);
+ found = true;
+ }
+ }
+ }
+
+ ct = MainWindow::audioEffects.count();
+ for (int ix = 0; ix < ct; ix ++) {
+ effectInfo = MainWindow::audioEffects.effectIdInfo(ix);
+ parentItem = NULL;
+ for (int i = 0; i < folders.count(); i++) {
+ QStringList l = folders.at(i)->data(0, IdRole).toString().split(',', QString::SkipEmptyParts);
+ if (l.contains(effectInfo.at(2))) {
+ parentItem = folders.at(i);
+ break;
+ }
+ }
+ if (parentItem == NULL) parentItem = audio;
+ if (!effectInfo.isEmpty()) {
+ item = new QTreeWidgetItem(parentItem, QStringList(effectInfo.takeFirst()));
+ item->setIcon(0, audioIcon);
+ item->setData(0, TypeRole, QString::number((int) EFFECT_AUDIO));
+ item->setData(0, IdRole, effectInfo);
+ if (item->text(0) == current) {
+ setCurrentItem(item);
+ found = true;
+ }
+ }
+ }
+
+ ct = MainWindow::customEffects.count();
+ kDebug() << "--- REBUILDING;: " << ct;
+ for (int ix = 0; ix < ct; ix ++) {
+ effectInfo = MainWindow::customEffects.effectIdInfo(ix);
+ if (!effectInfo.isEmpty()) {
+ item = new QTreeWidgetItem(custom, QStringList(effectInfo.takeFirst()));
+ item->setIcon(0, customIcon);
+ item->setData(0, TypeRole, QString::number((int) EFFECT_CUSTOM));
+ item->setData(0, IdRole, effectInfo);
+ if (item->text(0) == current) {
+ setCurrentItem(item);
+ found = true;
+ }
+ }
+ }
+ 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);