1 /***************************************************************************
2 fxsetupimpl.cpp - description
5 copyright : (C) 2003 by voglrobe
6 email : voglrobe@saphir
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 ***************************************************************************/
19 #include <QtGui/QPushButton>
24 // App specific inlcudes
25 #include "fxsetupimpl.h"
26 // #include "freeverbsetupimpl.h"
27 #include "fxpluginhandler.h"
29 FX_SetupImpl::FX_SetupImpl(QWidget
*parent
, const char *name
,
31 FXPluginHandler
*fxpluginhandler
)
32 : FX_Setup(parent
,name
), m_config(config
), m_fxpluginhandler(fxpluginhandler
)
34 m_fxpluginhandler
->getPlugins(pluginlist
);
40 FX_SetupImpl::~FX_SetupImpl()
44 void FX_SetupImpl::slotAdd()
46 // move effect from Available-List to Active-List
47 int index
= listBox_Available
->currentItem();
50 listBox_Active
->insertItem( listBox_Available
->text(index
), -1 );
51 listBox_Available
->removeItem( index
);
52 pushButton_removeAll
->setEnabled(true);
56 void FX_SetupImpl::slotRemove()
58 // move effect from Active-List to Available-List
59 int index
= listBox_Active
->currentItem();
62 listBox_Available
->insertItem( listBox_Active
->text(index
), -1 );
63 listBox_Active
->removeItem( index
);
65 if (listBox_Active
->count() == 0)
66 pushButton_removeAll
->setEnabled(false);
70 void FX_SetupImpl::slotRemoveAll()
72 kDebug() << "FX_SetupImpl::slotRemoveAll()";
74 // move all from Active-List to Available-List
75 for(uint i
=0; i
<listBox_Active
->count(); i
++){
76 listBox_Available
->insertItem( listBox_Active
->text((int)i
) );
78 listBox_Active
->clear();
79 pushButton_removeAll
->setEnabled(false);
83 void FX_SetupImpl::slotReload()
85 kDebug() << "FX_SetupImpl::slotReload()";
91 void FX_SetupImpl::slotConfigureEffect(Q3ListBoxItem
*item
)
93 m_fxpluginhandler
->showEffectGUI(item
->text());
97 void FX_SetupImpl::Init(QStringList c_avail
)
99 m_config
->setGroup("Effect Stack Configuration");
100 QStringList conf_active
= m_config
->readEntry("Activated",QStringList());
101 QStringList c_active
;
102 QStringList::Iterator sit
, it
;
104 listBox_Available
->clear();
105 listBox_Active
->clear();
108 pushButton_removeAll
->setEnabled(false);
110 for (sit
=conf_active
.begin(); sit
!=conf_active
.end(); ++sit
){
111 it
= c_avail
.find(*sit
);
112 if ( it
!=c_avail
.end() ){ // active plugin as per config-file in pluginlist found
113 c_active
.append(*sit
); // append to active list
114 c_avail
.remove(*sit
); // remove active plugin from the list of avail plugins
118 if ( !c_active
.isEmpty() ){
119 pushButton_removeAll
->setEnabled(true);
123 for(it
=c_avail
.begin(); it
!=c_avail
.end(); ++it
){
124 listBox_Available
->insertItem( (*it
), -1 );
126 for(it
=c_active
.begin(); it
!=c_active
.end(); ++it
){
127 listBox_Active
->insertItem( (*it
), -1 );
132 void FX_SetupImpl::slotSaveWasClicked()
134 m_config
->setGroup("Effect Stack Configuration");
136 // Read ListBox Available FX
138 for(uint i
=0; i
<listBox_Available
->count(); i
++){
139 slist
.append( listBox_Available
->text( (int)i
) );
142 m_config
->writeEntry("Available", slist
);
144 // Read ListBox Activated FX
146 for(uint i
=0; i
<listBox_Active
->count(); i
++){
147 slist
.append( listBox_Active
->text( (int)i
) );
150 m_config
->writeEntry("Activated", slist
);
155 #include "fxsetupimpl.moc"