Commit eecb50f6 authored by Jonathan Marten's avatar Jonathan Marten
Browse files

Eliminate ControlPool and ColorWidget, neither of them seem to be used

parent f344835a
/*
* KMix -- KDE's full featured mini mixer
*
*
* Copyright (c) The KMix Authors
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "ControlPool.h"
#include <QString>
#include <QMap>
shared_ptr<MixDevice> ControlPool::TheEmptyDevice; // = shared_ptr<MixDevice>(ControlPool::TheEmptyDevicePtr);
ControlPool::ControlPool()
{
pool = new QMap<QString, shared_ptr<MixDevice> >();
}
ControlPool* ControlPool::_instance = 0;
ControlPool* ControlPool::instance()
{
if ( _instance == 0 )
ControlPool::_instance = new ControlPool();
return ControlPool::_instance;
}
/**
* Adds a Control to the pool, and returns it wrapped in QSharedPointer.
* if the Control was already in the Pool, the existing Control is returned
*
* @param key A key, unique over all controls of all cards, e.g. "Master:0@ALSA::Creative_XFI:0"
* @param mixDevice
* @return
*/
shared_ptr<MixDevice> ControlPool::add(const QString& key, MixDevice* md)
{
shared_ptr<MixDevice> controlFromPool(get(key));
if ( controlFromPool.get() != 0)
{
qCDebug(KMIX_LOG) << "----ControlPool already cached key=" << key;
return controlFromPool;
}
// else: Add the control to the pool
qCDebug(KMIX_LOG) << "----ControlPool add key=" << key;
shared_ptr<MixDevice> mdShared(md);
pool->insert(key, mdShared);
return mdShared;
}
/**
* Retrieves a Control from the pool as QSharedPointer. If the Control is not
* in the pool, a QSharedPointer that points to null (0) is returned.
*
* @param key
* @return The Control wrapped in QSharedPointer. If not found, a QSharedPointer that points to null.
*/
shared_ptr<MixDevice> ControlPool::get(const QString& key)
{
shared_ptr<MixDevice> mixDeviceShared = pool->value(key, TheEmptyDevice);
return mixDeviceShared;
}
/*
* KMix -- KDE's full featured mini mixer
*
*
* Copyright (c) The KMix Authors
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef CONTROL_POOL_H
#define CONTROL_POOL_H
#if defined(HAVE_STD_SHARED_PTR)
#include <memory>
using std::shared_ptr;
#elif defined(HAVE_STD_TR1_SHARED_PTR)
#include <tr1/memory>
using std::tr1::shared_ptr;
#endif
#include "core/mixdevice.h"
class ControlPool
{
public:
static ControlPool* instance();
shared_ptr<MixDevice> add(const QString& key, MixDevice* mixDevice);
shared_ptr<MixDevice> get(const QString& key);
private:
ControlPool();
virtual ~ControlPool() {}
QMap<QString, shared_ptr<MixDevice> > *pool;
static ControlPool* _instance;
static shared_ptr<MixDevice> TheEmptyDevice;
};
#endif
......@@ -25,7 +25,6 @@
#include <klocalizedstring.h>
#include "core/ControlPool.h"
#include "core/mixer.h"
#include "dbus/dbuscontrolwrapper.h"
#include "gui/guiprofile.h"
......@@ -158,8 +157,7 @@ shared_ptr<MixDevice> MixDevice::addToPool()
{
// qCDebug(KMIX_LOG) << "id=" << _mixer->id() << ":" << _id;
shared_ptr<MixDevice> thisSharedPtr(this);
//shared_ptr<MixDevice> thisSharedPtr = ControlPool::instance()->add(fullyQualifiedId, this);
_dbusControlWrapper = new DBusControlWrapper( thisSharedPtr, dbusPath() );
_dbusControlWrapper = new DBusControlWrapper(thisSharedPtr, dbusPath());
return (thisSharedPtr);
}
......
......@@ -97,8 +97,8 @@ public:
/**
* Constructor for a MixDevice.
* After having constructed a MixDevice, you <b>must</b> add it to the ControlPool
* by calling addToPool(). You may then <b>not</b> delete this object.
* After having constructed a MixDevice, you <b>must</b> add it to the DBus
* interfaces by calling addToPool(). You may then <b>not</b> delete this object.
*
* @par mixer The mixer this control belongs to
* @par id Defines the ID, e.g. used in looking up the keys in kmixrc. Also it is used heavily inside KMix as unique key.
......
<ui version="4.0" stdsetdef="1" >
<author>Stefan Schimanski &lt;1Stein@gmx.de></author>
<class>ColorWidget</class>
<widget class="QWidget" name="ColorWidget" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>272</width>
<height>305</height>
</rect>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="customColors" >
<property name="text" >
<string>&amp;Use custom colors</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="activeColors" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="title" >
<string>Active</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<item row="2" column="1" >
<widget class="KColorButton" name="activeBack" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="TextLabel3" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="text" >
<string>&amp;Silent:</string>
</property>
<property name="buddy" stdset="0" >
<cstring>activeLow</cstring>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="KColorButton" name="activeLow" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="KColorButton" name="activeHigh" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="labelLoad" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="text" >
<string>&amp;Loud:</string>
</property>
<property name="buddy" stdset="0" >
<cstring>activeHigh</cstring>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="TextLabel4" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="text" >
<string>&amp;Background:</string>
</property>
<property name="buddy" stdset="0" >
<cstring>activeBack</cstring>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="mutedColors" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="title" >
<string>Muted</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<item row="0" column="0" >
<widget class="QLabel" name="TextLabel6" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="text" >
<string>Lou&amp;d:</string>
</property>
<property name="buddy" stdset="0" >
<cstring>mutedHigh</cstring>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="TextLabel8" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="text" >
<string>Backgrou&amp;nd:</string>
</property>
<property name="buddy" stdset="0" >
<cstring>mutedBack</cstring>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="TextLabel7" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="text" >
<string>Silen&amp;t:</string>
</property>
<property name="buddy" stdset="0" >
<cstring>mutedLow</cstring>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="KColorButton" name="mutedHigh" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="KColorButton" name="mutedLow" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="KColorButton" name="mutedBack" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="spacer5" >
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="sizeType" >
<enum>Expanding</enum>
</property>
<property name="orientation" >
<enum>Vertical</enum>
</property>
</spacer>
</item>
</layout>
</widget>
<tabstops>
<tabstop>customColors</tabstop>
<tabstop>activeHigh</tabstop>
<tabstop>activeLow</tabstop>
<tabstop>activeBack</tabstop>
<tabstop>mutedHigh</tabstop>
<tabstop>mutedLow</tabstop>
<tabstop>mutedBack</tabstop>
</tabstops>
<includes>
<include location="global" >klocalizedstring.h</include>
<include location="global" >kseparator.h</include>
</includes>
<connections>
<connection>
<sender>customColors</sender>
<signal>toggled(bool)</signal>
<receiver>activeColors</receiver>
<slot>setEnabled(bool)</slot>
</connection>
<connection>
<sender>customColors</sender>
<signal>toggled(bool)</signal>
<receiver>mutedColors</receiver>
<slot>setEnabled(bool)</slot>
</connection>
</connections>
</ui>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment