lyr->addWidget(m_effectsList);
lyr->setContentsMargins(0, 0, 0, 0);
search_effect->setTreeWidget(m_effectsList);
+ search_effect->setToolTip(i18n("Search in the effect list"));
buttonInfo->setIcon(KIcon("help-about"));
+ buttonInfo->setToolTip(i18n("Show/Hide the effect description"));
setFocusPolicy(Qt::StrongFocus);
+ setFocusProxy(search_effect);
+ m_effectsList->setFocusProxy(search_effect);
- if (KdenliveSettings::showeffectinfo()) {
+ if (KdenliveSettings::showeffectinfo())
buttonInfo->setDown(true);
- } else infopanel->hide();
+ else
+ infopanel->hide();
+
menu->addAction(KIcon("edit-delete"), i18n("Delete effect"), this, SLOT(slotRemoveEffect()));
connect(type_combo, SIGNAL(currentIndexChanged(int)), this, SLOT(filterList(int)));
connect(m_effectsList, SIGNAL(itemSelectionChanged()), this, SLOT(slotUpdateInfo()));
connect(m_effectsList, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(slotEffectSelected()));
connect(search_effect, SIGNAL(hiddenChanged(QTreeWidgetItem *, bool)), this, SLOT(slotUpdateSearch(QTreeWidgetItem *, bool)));
+ connect(search_effect, SIGNAL(textChanged(QString)), this, SLOT(slotAutoExpand(QString)));
//m_effectsList->setCurrentRow(0);
}
-
-void EffectsListView::focusInEvent(QFocusEvent * /*event*/)
-{
- search_effect->setFocus();
-}
-
void EffectsListView::filterList(int pos)
{
for (int i = 0; i < m_effectsList->topLevelItemCount(); i++) {
// make sure we don't show anything not matching the search expression
search_effect->updateSearch();
+
/*item = m_effectsList->currentItem();
if (item) {
if (item->isHidden()) {
void EffectsListView::showInfoPanel()
{
- if (infopanel->isVisible()) {
- infopanel->setVisible(false);
- buttonInfo->setDown(false);
- KdenliveSettings::setShoweffectinfo(false);
- } else {
- infopanel->setVisible(true);
- buttonInfo->setDown(true);
- KdenliveSettings::setShoweffectinfo(true);
- }
+ bool show = !infopanel->isVisible();
+ infopanel->setVisible(show);
+ buttonInfo->setDown(show);
+ KdenliveSettings::setShoweffectinfo(show);
}
void EffectsListView::slotEffectSelected()
{
QDomElement effect = m_effectsList->currentEffect();
- if (!effect.isNull()) emit addEffect(effect);
+ if (!effect.isNull())
+ emit addEffect(effect);
}
void EffectsListView::slotUpdateInfo()
{
if (!hidden) {
if (item->data(0, Qt::UserRole).toInt() == type_combo->currentIndex()) {
- item->parent()->setHidden(false);
+ if (item->parent())
+ item->parent()->setHidden(false);
} else {
if (type_combo->currentIndex() != 0)
item->setHidden(true);
}
}
+void EffectsListView::slotAutoExpand(QString text)
+{
+ search_effect->updateSearch();
+
+ for (int i = 0; i < m_effectsList->topLevelItemCount(); ++i) {
+ QTreeWidgetItem *folder = m_effectsList->topLevelItem(i);
+ bool expandFolder = false;
+ /*if (folder->isHidden())
+ continue;*/
+ if (!text.isEmpty()) {
+ for (int j = 0; j < folder->childCount(); j++) {
+ QTreeWidgetItem *item = folder->child(j);
+ if (!item->isHidden())
+ expandFolder = true;
+ }
+ }
+ folder->setExpanded(expandFolder);
+ }
+}
+
#include "effectslistview.moc"