fix i18nc typo in last commit
[kdeaccessibility.git] / ksayit / src / fxsetupimpl.cpp
blob82e428d551c9b3a6b97ec3a12c344bf9e5bddfb0
1 /***************************************************************************
2 fxsetupimpl.cpp - description
3 -------------------
4 begin : Mo Nov 24 2003
5 copyright : (C) 2003 by voglrobe
6 email : voglrobe@saphir
7 ***************************************************************************/
9 /***************************************************************************
10 * *
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. *
15 * *
16 ***************************************************************************/
18 // QT includes
19 #include <QtGui/QPushButton>
21 // KDE includes
22 #include <kdebug.h>
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,
30 KConfig *config,
31 FXPluginHandler *fxpluginhandler )
32 : FX_Setup(parent,name), m_config(config), m_fxpluginhandler(fxpluginhandler)
34 m_fxpluginhandler->getPlugins(pluginlist);
36 Init(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();
48 if ( index == -1 )
49 return;
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();
60 if ( index == -1 )
61 return;
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()";
87 Init(pluginlist);
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();
106 c_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);
122 // Fill ListBoxes
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
137 QStringList slist;
138 for(uint i=0; i<listBox_Available->count(); i++){
139 slist.append( listBox_Available->text( (int)i) );
141 // Write StringList
142 m_config->writeEntry("Available", slist);
144 // Read ListBox Activated FX
145 slist.clear();
146 for(uint i=0; i<listBox_Active->count(); i++){
147 slist.append( listBox_Active->text( (int)i) );
149 // Write StringList
150 m_config->writeEntry("Activated", slist);
151 slist.clear();
155 #include "fxsetupimpl.moc"