39
39
#include "kmixtoolbox.h"
40
40
#include "mixdevicewidget.h"
42
#include "mixertoolbox.h"
44
45
ViewBase::ViewBase(QWidget* parent, const char* id, Mixer* mixer, Qt::WFlags f, ViewBase::ViewFlags vflags, GUIProfile *guiprof, KActionCollection *actionColletion)
76
77
action->setText(i18n("&Channels"));
77
78
connect(action, SIGNAL(triggered(bool) ), SLOT(configureView()));
78
79
connect ( _mixer, SIGNAL(controlChanged()), this, SLOT(refreshVolumeLevels()) );
80
connect ( _mixer, SIGNAL(controlsReconfigured(const QString&)), this, SLOT(controlsReconfigured(const QString&)) );
81
83
ViewBase::~ViewBase() {
203
205
_popMenu->popup( pos );
208
void ViewBase::controlsReconfigured( const QString& mixer_ID )
210
if ( _mixer->id() == mixer_ID )
212
kDebug(67100) << "ViewBase::controlsReconfigured() " << mixer_ID << " is being redrawn (mixset contains: " << _mixSet->count() << ")";
214
kDebug(67100) << "ViewBase::controlsReconfigured() " << mixer_ID << ": Recreating widgets (mixset contains: " << _mixSet->count() << ")";
215
createDeviceWidgets();
217
// We've done the low level stuff our selves but let elements
218
// above know what has happened so they can reload config etc.
219
emit redrawMixer(mixer_ID);
207
223
void ViewBase::refreshVolumeLevels()
212
Mixer* ViewBase::getMixer() {
228
Mixer* ViewBase::getMixer()
233
void ViewBase::setMixSet()
235
if ( _mixer->dynamic()) {
237
// Check the guiprofile... if it is not the fallback GUIProfile, then
238
// make sure that we add a specific entry for any devices not present.
239
if ( 0 != _guiprof && MixerToolBox::instance()->fallbackProfile(_mixer) != _guiprof ) {
240
kDebug(67100) << "Dynamic mixer " << _mixer->id() << " is NOT using Fallback GUIProfile. Checking to see if new controls are present";
242
QList<QString> new_mix_devices;
243
MixSet ms = _mixer->getMixSet();
244
for (int i=0; i < ms.count(); ++i)
245
new_mix_devices.append("^" + ms[i]->id() + "$");
246
std::vector<ProfControl*>::const_iterator itEnd = _guiprof->_controls.end();
247
for ( std::vector<ProfControl*>::const_iterator it = _guiprof->_controls.begin(); it != itEnd; ++it)
248
new_mix_devices.removeAll((*it)->id);
250
if ( new_mix_devices.count() > 0 ) {
251
kDebug(67100) << "Found " << new_mix_devices.count() << " new controls. Adding to GUIProfile";
252
while ( new_mix_devices.count() > 0 ) {
253
ProfControl* ctl = new ProfControl();
254
ctl->id = new_mix_devices.takeAt(0);
255
ctl->subcontrols = ".*";
256
ctl->tab = _guiprof->_tabs[0]->name; // Use the first tab... not ideal but should work most of the time;
257
ctl->show = "simple";
258
_guiprof->_controls.push_back(ctl);
261
profileName = _mixer->id() + "." + id();
262
_guiprof->writeProfile(profileName);
266
// We need to delete the current MixDeviceWidgets so we can redraw them
267
while (!_mdws.isEmpty()) {
268
QWidget* mdw = _mdws.last();
273
// Clean up our _mixSet so we can reapply our GUIProfile
217
281
* Open the View configuration dialog. The user can select which channels he wants
218
282
* to see and which not.