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;
46 QPair<QString,QMap<int,QVariant> > testpair("gray",data);
47 points.append(testpair);
49 QMap<int,QVariant> data1;
54 QPair<QString,QMap<int,QVariant> > testpair1("dx",data1);
55 points.append(testpair1);
57 ui.kplotwidget->setPointLists(points,0,305);
61 void EffectStackView::slotClipItemSelected(ClipItem* c)
66 effects=clipref->effectNames();
67 setupListView(effects);
71 void EffectStackView::setupListView(const QStringList& effects_list){
73 ui.effectlist->clear();
74 ui.effectlist->addItems(effects);
75 for (int i=0;i< ui.effectlist->count();i++){
76 QListWidgetItem* item=ui.effectlist->item(i);
77 item->setFlags(Qt::ItemIsSelectable|Qt::ItemIsDragEnabled|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled);
78 item->setCheckState(Qt::Checked);
80 item->setSelected(true);
85 void EffectStackView::slotItemSelectionChanged(){
87 if (ui.effectlist->currentItem() && ui.effectlist->currentItem()->isSelected() ){
88 activeRow=ui.effectlist->row( ui.effectlist->currentItem() );
92 ui.buttonDel->setEnabled( activeRow!=-1);
93 ui.buttonUp->setEnabled( activeRow >0 );
94 ui.buttonDown->setEnabled( (activeRow<ui.effectlist->count()-1) && activeRow>=0 );
97 void EffectStackView::slotItemUp(){
98 if (activeRow>0 && activeRow <effects.size() ){
99 effects.swap(activeRow, activeRow-1);
102 setupListView(effects);
106 void EffectStackView::slotItemDown(){
107 if (activeRow<effects.size()-1 ){
108 effects.swap(activeRow, activeRow+1);
111 setupListView(effects);
115 void EffectStackView::slotItemDel(){
116 if (activeRow<effects.size() && activeRow>=0 ){
117 effects.removeAt(activeRow);
119 if (effects.size()>0 && activeRow>0)
121 setupListView(effects);
125 #include "effectstackview.moc"