1 /***************************************************************************
2 effecstackview.cpp - description
5 copyright : (C) 2008 by Marco Gittler
6 email : g.marco@freenet.de
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
21 #include "effectstackview.h"
23 #include <QHeaderView>
25 EffectStackView::EffectStackView( QWidget *parent)
29 //ui.effectlist->horizontalHeader()->setVisible(false);
30 //ui.effectlist->verticalHeader()->setVisible(false);
33 connect (ui.effectlist, SIGNAL ( itemSelectionChanged()), this , SLOT( slotItemSelectionChanged() ));
34 connect (ui.buttonUp, SIGNAL (clicked()), this, SLOT (slotItemUp()) );
35 connect (ui.buttonDown, SIGNAL (clicked()), this, SLOT (slotItemDown()) );
36 connect (ui.buttonDel, SIGNAL (clicked()), this, SLOT (slotItemDel()) );
40 QList< QPair<QString, QMap<int,QVariant> > > points;
41 QMap<int,QVariant> data;
45 QPair<QString,QMap<int,QVariant> > testpair("contrast",data);
46 points.append(testpair);
47 ui.kplotwidget->setPointLists(points,0,300);
51 void EffectStackView::slotClipItemSelected(ClipItem* c)
56 effects=clipref->effectNames();
57 setupListView(effects);
61 void EffectStackView::setupListView(const QStringList& effects_list){
63 ui.effectlist->clear();
64 ui.effectlist->addItems(effects);
65 for (int i=0;i< ui.effectlist->count();i++){
66 QListWidgetItem* item=ui.effectlist->item(i);
67 item->setFlags(Qt::ItemIsSelectable|Qt::ItemIsDragEnabled|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled);
68 item->setCheckState(Qt::Checked);
70 item->setSelected(true);
75 void EffectStackView::slotItemSelectionChanged(){
77 if (ui.effectlist->currentItem() && ui.effectlist->currentItem()->isSelected() ){
78 activeRow=ui.effectlist->row( ui.effectlist->currentItem() );
82 ui.buttonDel->setEnabled( activeRow!=-1);
83 ui.buttonUp->setEnabled( activeRow >0 );
84 ui.buttonDown->setEnabled( (activeRow<ui.effectlist->count()-1) && activeRow>=0 );
87 void EffectStackView::slotItemUp(){
88 if (activeRow>0 && activeRow <effects.size() ){
89 effects.swap(activeRow, activeRow-1);
92 setupListView(effects);
96 void EffectStackView::slotItemDown(){
97 if (activeRow<effects.size()-1 ){
98 effects.swap(activeRow, activeRow+1);
101 setupListView(effects);
105 void EffectStackView::slotItemDel(){
106 if (activeRow<effects.size() && activeRow>=0 ){
107 effects.removeAt(activeRow);
109 if (effects.size()>0 && activeRow>0)
111 setupListView(effects);
115 #include "effectstackview.moc"