1 /***************************************************************************
2 * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
24 #include "effectslistview.h"
26 EffectsListView::EffectsListView(EffectsList *audioEffectList, EffectsList *videoEffectList, EffectsList *customEffectList, QWidget *parent)
29 m_effectsList = new EffectsListWidget(audioEffectList, videoEffectList, customEffectList);
32 QVBoxLayout *lyr = new QVBoxLayout(ui.effectlistframe);
33 lyr->addWidget(m_effectsList);
34 ui.search_effect->setListWidget(m_effectsList);
35 ui.buttonInfo->setIcon(KIcon("help-about"));
38 connect(ui.type_combo, SIGNAL(currentIndexChanged(int)), this, SLOT(filterList(int)));
39 connect (ui.buttonInfo, SIGNAL (clicked()), this, SLOT (showInfoPanel()));
40 connect(m_effectsList, SIGNAL(itemSelectionChanged()), this, SLOT(slotUpdateInfo()));
41 connect(m_effectsList, SIGNAL(doubleClicked(QListWidgetItem *,const QPoint &)), this, SLOT(slotEffectSelected()));
43 m_effectsList->setCurrentRow(0);
47 void EffectsListView::filterList(int pos)
49 QListWidgetItem *item;
50 for (int i = 0; i < m_effectsList->count(); i++)
52 item = m_effectsList->item(i);
53 if (pos == 0) item->setHidden(false);
54 else if (item->data(Qt::UserRole).toInt() == pos) item->setHidden(false);
55 else item->setHidden(true);
57 item = m_effectsList->currentItem();
59 if (item->isHidden()) {
61 for (i = 0; i < m_effectsList->count() && m_effectsList->item(i)->isHidden(); i++);
62 m_effectsList->setCurrentRow(i);
64 else m_effectsList->scrollToItem(item);
68 void EffectsListView::showInfoPanel()
70 if (ui.infopanel->isVisible()) {
72 ui.buttonInfo->setDown(false);
76 ui.buttonInfo->setDown(true);
80 void EffectsListView::slotEffectSelected()
82 QDomElement effect = m_effectsList->currentEffect();
83 if (!effect.isNull()) emit addEffect(effect);
86 void EffectsListView::slotUpdateInfo()
88 QString info = m_effectsList->currentInfo();
89 if (!info.isEmpty()) ui.infopanel->setText(info);
92 KListWidget *EffectsListView::listView()
97 #include "effectslistview.moc"