SVN_SILENT made messages (.desktop file)
[kdeaccessibility.git] / ksayit / src / fxsetupimpl.cpp
blob4b8efc479bce4c75e80d0b1495f49e7206f1f0fa
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 <QStringList>
20 #include <QPushButton>
22 // KDE includes
23 #include <kdebug.h>
25 // App specific inlcudes
26 #include "fxsetupimpl.h"
27 // #include "freeverbsetupimpl.h"
28 #include "fxpluginhandler.h"
30 FX_SetupImpl::FX_SetupImpl(QWidget *parent, const char *name,
31 KConfig *config,
32 FXPluginHandler *fxpluginhandler )
33 : FX_Setup(parent,name), m_config(config), m_fxpluginhandler(fxpluginhandler)
35 m_fxpluginhandler->getPlugins(pluginlist);
37 Init(pluginlist);
41 FX_SetupImpl::~FX_SetupImpl()
45 void FX_SetupImpl::slotAdd()
47 // move effect from Available-List to Active-List
48 int index = listBox_Available->currentItem();
49 if ( index == -1 )
50 return;
51 listBox_Active ->insertItem( listBox_Available->text(index), -1 );
52 listBox_Available->removeItem( index );
53 pushButton_removeAll->setEnabled(true);
57 void FX_SetupImpl::slotRemove()
59 // move effect from Active-List to Available-List
60 int index = listBox_Active->currentItem();
61 if ( index == -1 )
62 return;
63 listBox_Available->insertItem( listBox_Active->text(index), -1 );
64 listBox_Active ->removeItem( index );
66 if (listBox_Active->count() == 0)
67 pushButton_removeAll->setEnabled(false);
71 void FX_SetupImpl::slotRemoveAll()
73 kDebug() << "FX_SetupImpl::slotRemoveAll()" << endl;
75 // move all from Active-List to Available-List
76 for(uint i=0; i<listBox_Active->count(); i++){
77 listBox_Available->insertItem( listBox_Active->text((int)i) );
79 listBox_Active->clear();
80 pushButton_removeAll->setEnabled(false);
84 void FX_SetupImpl::slotReload()
86 kDebug() << "FX_SetupImpl::slotReload()" << endl;
88 Init(pluginlist);
92 void FX_SetupImpl::slotConfigureEffect(Q3ListBoxItem *item)
94 m_fxpluginhandler->showEffectGUI(item->text());
98 void FX_SetupImpl::Init(QStringList c_avail)
100 m_config->setGroup("Effect Stack Configuration");
101 QStringList conf_active = m_config->readEntry("Activated",QStringList());
102 QStringList c_active;
103 QStringList::Iterator sit, it;
105 listBox_Available->clear();
106 listBox_Active->clear();
107 c_active.clear();
109 pushButton_removeAll->setEnabled(false);
111 for (sit=conf_active.begin(); sit!=conf_active.end(); ++sit){
112 it = c_avail.find(*sit);
113 if ( it!=c_avail.end() ){ // active plugin as per config-file in pluginlist found
114 c_active.append(*sit); // append to active list
115 c_avail.remove(*sit); // remove active plugin from the list of avail plugins
119 if ( !c_active.isEmpty() ){
120 pushButton_removeAll->setEnabled(true);
123 // Fill ListBoxes
124 for(it=c_avail.begin(); it!=c_avail.end(); ++it){
125 listBox_Available->insertItem( (*it), -1 );
127 for(it=c_active.begin(); it!=c_active.end(); ++it){
128 listBox_Active->insertItem( (*it), -1 );
133 void FX_SetupImpl::slotSaveWasClicked()
135 m_config->setGroup("Effect Stack Configuration");
137 // Read ListBox Available FX
138 QStringList slist;
139 for(uint i=0; i<listBox_Available->count(); i++){
140 slist.append( listBox_Available->text( (int)i) );
142 // Write StringList
143 m_config->writeEntry("Available", slist);
145 // Read ListBox Activated FX
146 slist.clear();
147 for(uint i=0; i<listBox_Active->count(); i++){
148 slist.append( listBox_Active->text( (int)i) );
150 // Write StringList
151 m_config->writeEntry("Activated", slist);
152 slist.clear();
156 #include "fxsetupimpl.moc"