1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
/***************************************************************************
fxsetupimpl.cpp - description
-------------------
begin : Mo Nov 24 2003
copyright : (C) 2003 by voglrobe
email : voglrobe@saphir
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
// QT includes
#include <qstringlist.h>
#include <qpushbutton.h>
// KDE includes
#include <kdebug.h>
// App specific inlcudes
#include "fxsetupimpl.h"
// #include "freeverbsetupimpl.h"
#include "fxpluginhandler.h"
FX_SetupImpl::FX_SetupImpl(QWidget *parent, const char *name,
KConfig *config,
FXPluginHandler *fxpluginhandler )
: FX_Setup(parent,name), m_config(config), m_fxpluginhandler(fxpluginhandler)
{
m_fxpluginhandler->getPlugins(pluginlist);
Init(pluginlist);
}
FX_SetupImpl::~FX_SetupImpl()
{
}
void FX_SetupImpl::slotAdd()
{
// move effect from Available-List to Active-List
int index = listBox_Available->currentItem();
if ( index == -1 )
return;
listBox_Active ->insertItem( listBox_Available->text(index), -1 );
listBox_Available->removeItem( index );
pushButton_removeAll->setEnabled(true);
}
void FX_SetupImpl::slotRemove()
{
// move effect from Active-List to Available-List
int index = listBox_Active->currentItem();
if ( index == -1 )
return;
listBox_Available->insertItem( listBox_Active->text(index), -1 );
listBox_Active ->removeItem( index );
if (listBox_Active->count() == 0)
pushButton_removeAll->setEnabled(false);
}
void FX_SetupImpl::slotRemoveAll()
{
kdDebug() << "FX_SetupImpl::slotRemoveAll()" << endl;
// move all from Active-List to Available-List
for(uint i=0; i<listBox_Active->count(); i++){
listBox_Available->insertItem( listBox_Active->text((int)i) );
}
listBox_Active->clear();
pushButton_removeAll->setEnabled(false);
}
void FX_SetupImpl::slotReload()
{
kdDebug() << "FX_SetupImpl::slotReload()" << endl;
Init(pluginlist);
}
void FX_SetupImpl::slotConfigureEffect(QListBoxItem *item)
{
m_fxpluginhandler->showEffectGUI(item->text());
}
void FX_SetupImpl::Init(QStringList c_avail)
{
m_config->setGroup("Effect Stack Configuration");
QStringList conf_active = m_config->readListEntry("Activated");
QStringList c_active;
QStringList::Iterator sit, it;
listBox_Available->clear();
listBox_Active->clear();
c_active.clear();
pushButton_removeAll->setEnabled(false);
for (sit=conf_active.begin(); sit!=conf_active.end(); ++sit){
it = c_avail.find(*sit);
if ( it!=c_avail.end() ){ // active plugin as per config-file in pluginlist found
c_active.append(*sit); // append to active list
c_avail.remove(*sit); // remove active plugin from the list of avail plugins
}
}
if ( !c_active.isEmpty() ){
pushButton_removeAll->setEnabled(true);
}
// Fill ListBoxes
for(it=c_avail.begin(); it!=c_avail.end(); ++it){
listBox_Available->insertItem( (*it), -1 );
}
for(it=c_active.begin(); it!=c_active.end(); ++it){
listBox_Active->insertItem( (*it), -1 );
}
}
void FX_SetupImpl::slotSaveWasClicked()
{
m_config->setGroup("Effect Stack Configuration");
// Read ListBox Available FX
QStringList slist;
for(uint i=0; i<listBox_Available->count(); i++){
slist.append( listBox_Available->text( (int)i) );
}
// Write StringList
m_config->writeEntry("Available", slist);
// Read ListBox Activated FX
slist.clear();
QString t;
for(uint i=0; i<listBox_Active->count(); i++){
t = listBox_Active->text( (int)i );
slist.append( t );
}
// Write StringList
m_config->writeEntry("Activated", slist);
m_config->sync();
slist.clear();
}
#include "fxsetupimpl.moc"
|