[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/kmix
From: Christian Esken <esken () kde ! org>
Date: 2010-06-29 21:45:36
Message-ID: 20100629214536.3A07FAC8E3 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1144420 by esken:
Major GUIProfile cleanup: ProfControl refactoring (including removal of "Tab" from \
ProfControl). Tab ID's are now correct for saving and loading.
Progressions in MixDeviceComposite.
M +7 -7 dialogviewconfiguration.cpp
M +19 -64 guiprofile.cpp
M +5 -6 guiprofile.h
M +7 -3 kmix.cpp
M +2 -0 mixdevice.cpp
M +1 -1 mixdevicecomposite.cpp
M +1 -1 mixdevicecomposite.h
M +7 -5 viewbase.cpp
M +4 -3 viewsliders.cpp
--- branches/work/kmix/dialogviewconfiguration.cpp #1144419:1144420
@@ -326,22 +326,22 @@
prepareControls(model, false, oldControlset, newControlset);
// --- Step 2: Copy controls
- QString tabName = "Base";
+ //QString tabName = "Base";
oldControlset.clear();
std::vector<ProfControl*>::const_iterator itEnd = newControlset.end();
for ( std::vector<ProfControl*>::const_iterator it = newControlset.begin(); it != \
itEnd; ++it) {
ProfControl* control = *it;
control->id = "^" + control->id + "$"; // Create a regexp from the control name
- if ( ! control->tab.isEmpty() )
- tabName = control->tab;
+// if ( ! control->tab.isEmpty() )
+// tabName = control->tab;
kDebug() << "Add control " << control->id;
oldControlset.push_back(control);
}
- ProfControl* fallbackMatchAllControl = new ProfControl;
- fallbackMatchAllControl->id = "^.*$";
- fallbackMatchAllControl->setSubcontrols("*");
- fallbackMatchAllControl->tab = tabName;
+ QString sctlMatchAll("*");
+ QString pctlId("^.*$") ;
+ ProfControl* fallbackMatchAllControl = new ProfControl(pctlId, sctlMatchAll);
+// fallbackMatchAllControl->tab = tabName;
fallbackMatchAllControl->show = "extended";
oldControlset.push_back(fallbackMatchAllControl);
--- branches/work/kmix/guiprofile.cpp #1144419:1144420
@@ -232,12 +232,10 @@
prd->productRelease = "1.0";
fallback->_products.insert(prd);
- ProfControl* ctl = new ProfControl();
static QString matchAll(".*");
- ctl->id = matchAll;
+ static QString matchAllSctl(".*");
+ ProfControl* ctl = new ProfControl(matchAll, matchAllSctl);
ctl->regexp = matchAll; // make sure id matches the regexp
- ctl->setSubcontrols(matchAll);
- ctl->show = "simple";
fallback->_controls.push_back(ctl);
fallback->_soundcardDriver = mixer->getDriverName();
@@ -307,33 +305,6 @@
bool ok = true;
// Reading is OK => now make the profile consistent
- // (1) Make sure the _tabs are complete (add any missing Tabs)
- std::vector<ProfControl*>::const_iterator itEnd = _controls.end();
- for ( std::vector<ProfControl*>::const_iterator it = _controls.begin(); it != \
itEnd; ++it)
- {
- ProfControl* control = *it;
- QString tabnameOfControl = control->tab;
- if ( tabnameOfControl.isNull() ) {
- tabnameOfControl = "Controls";
- control->tab = "Controls";
- }
- // check, whether we have this Tab yet.
- //std::vector<ProfTab*>::iterator tabRef = std::find(_tabs.begin(), _tabs.end(), \
tabnameOfControl);
- QList<ProfTab*>::const_iterator itTEnd = _tabs.end();
- QList<ProfTab*>::const_iterator itT = _tabs.begin();
- for ( ; itT != itTEnd; ++itT) {
- if ( (*itT)->name() == tabnameOfControl ) break;
- }
- if ( itT == itTEnd ) {
- // no such Tab yet => insert it
- ProfTab* tab = new ProfTab();
- tab->setName(tabnameOfControl);
- tab->setType("Sliders"); // as long as we don't know better
- if ( tab->id().isNull() ) tab->setId( tab->name() );;
- _tabs.push_back(tab);
- } // tab does not exist yet => insert new tab
- } // Step (1)
-
// (2) Make sure that there is at least one Tab
if ( _tabs.size() == 0) {
ProfTab* tab = new ProfTab();
@@ -343,22 +314,6 @@
_tabs.push_back(tab);
} // Step (2)
-
-/*
- // (3) Assign a Tab Name to all controls that have no defined Tab Name yet.
- ProfTab* tab = _tabs.front();
- itEnd = _controls.end(); for ( std::vector<ProfControl*>::const_iterator it = \
_controls.begin(); it != itEnd; ++it)
- {
- ProfControl* control = *it;
- QString& tabnameOfControl = control->tab;
- if ( tabnameOfControl.isNull() ) {
- // OK, it has no TabName defined. We will assign a TabName in step (3).
- control->tab = tab->name;
- }
- } // Step (3)
- //std::cout << "Consistent Profile: " << *this;
-*/
-
return ok;
}
@@ -476,9 +431,9 @@
os << " name=\"" << xmlify(profControl->name).toUtf8().constData() << "\"" ;
}
os << " subcontrols=\"" << xmlify( \
profControl->renderSubcontrols().toUtf8().constData()) << "\"" ;
- if ( ! profControl->tab.isNull() ) {
- os << " tab=\"" << xmlify(profControl->tab).toUtf8().constData() << "\"" ;
- }
+// if ( ! profControl->tab.isNull() ) {
+// os << " tab=\"" << xmlify(profControl->tab).toUtf8().constData() << "\"" ;
+// }
os << " show=\"" << xmlify(profControl->show).toUtf8().constData() << "\"" ;
os << " />" << endl;
} // for all controls
@@ -528,10 +483,10 @@
os << " Name = " << profControl->name.toUtf8().constData() << std::endl;
}
os << " Subcontrols=" << profControl->renderSubcontrols().toUtf8().constData() << \
std::endl;
- if ( ! profControl->tab.isNull() ) {
- os << " Tab=" << profControl->tab.toUtf8().constData() << std::endl;
- }
- os << " Shown-On=" << profControl->show.toUtf8().constData() << std::endl;
+// if ( ! profControl->tab.isNull() ) {
+// os << " Tab=" << profControl->tab.toUtf8().constData() << std::endl;
+// }
+// os << " Shown-On=" << profControl->show.toUtf8().constData() << std::endl;
} // for all controls
/*
@@ -551,7 +506,10 @@
_type = "";
}
-ProfControl::ProfControl(){
+ProfControl::ProfControl(QString& id, QString& subcontrols ){
+ this->show = "simple";
+ this->id = id;
+ setSubcontrols(subcontrols);
}
ProfControl::ProfControl(const ProfControl &profControl){
@@ -561,7 +519,7 @@
QString origSctls = profControl._subcontrols;
setSubcontrols(origSctls);
name = profControl.name;
- tab = profControl.tab;
+// tab = profControl.tab;
show = profControl.show;
backgroundColor = profControl.backgroundColor;
switchtype = profControl.switchtype;
@@ -789,13 +747,12 @@
QString switchtype = attributes.value("switchtype");
if ( !id.isNull() ) {
// We need at least an "id". We can set defaults for the rest, if undefined.
- ProfControl *profControl = new ProfControl();
if ( subcontrols.isNull() || subcontrols.isEmpty() ) {
subcontrols = "*"; // for compatibility reasons, we interpret an empty string as \
match-all (aka "*") }
- if ( tab.isNull() ) {
- // Ignore this for the moment. We will put it on the first existing Tab at the \
end of parsing
- }
+// if ( tab.isNull() ) {
+// // Ignore this for the moment. We will put it on the first existing Tab at the \
end of parsing +// }
if ( name.isNull() ) {
// ignore. isNull() will be checked by all users.
}
@@ -810,13 +767,11 @@
regexp = !name.isNull() ? name : id;
}
+ ProfControl *profControl = new ProfControl(id, subcontrols);
if ( show.isNull() ) { show = "*"; }
- profControl->id = id;
profControl->name = name;
- profControl->setSubcontrols(subcontrols);
- profControl->name = name;
- profControl->tab = tab;
+// profControl->tab = tab;
profControl->show = show;
profControl->backgroundColor.setNamedColor (background);
profControl->switchtype = switchtype;
--- branches/work/kmix/guiprofile.h #1144419:1144420
@@ -54,7 +54,7 @@
class ProfControl
{
public:
- ProfControl(); // default constructor
+ ProfControl(QString& id, QString& subcontrols);
ProfControl(const ProfControl &ctl); // copy constructor
// ID as returned by the Mixer Backend, e.g. Master:0
QString id;
@@ -67,8 +67,7 @@
bool useSubcontrolEnum() {return _useSubcontrolEnum;};
QString renderSubcontrols();
- // In case the vendor ships different products under the same productName
- QString tab;
+ //QString tab;
// Visible name for the User ( if name.isNull(), id will be used - And in the \
future a default lookup table will be consulted ). // Because the name is visible, \
some kind of i18n() will be used. QString name;
@@ -88,7 +87,7 @@
// When we start using it, it might be changed into a std::vector in the future.
// THIS IS RAW DATA AS LOADED FROM THE PROFILE. DO NOT USE IT, except for \
debugging. QString _subcontrols;
- // The follwoing are the deserialized values of _subcontrols
+ // The following are the deserialized values of _subcontrols
bool _useSubcontrolPlayback;
bool _useSubcontrolCapture;
bool _useSubcontrolPlaybackSwitch;
@@ -100,7 +99,7 @@
{
public:
ProfTab();
- // Name of the Tab, in english
+ // Name of the Tab, in English
QString name() { return _name; }
// ID of the Tab
QString id() { return _id; }
@@ -155,6 +154,7 @@
static GUIProfile* find(Mixer* mixer, QString profileName, bool allowFallback);
static GUIProfile* selectProfileFromXMLfiles(Mixer*, QString preferredProfile);
static GUIProfile* fallbackProfile(Mixer*);
+ static QString buildProfileName(Mixer* mixer, QString profileName, bool \
ignoreCard);
QString getName() const { return _name; }
void setName(QString _name) { this->_name = _name; }
@@ -172,7 +172,6 @@
// Loading
static GUIProfile* loadProfileFromXMLfiles(Mixer* mixer, QString profileName);
- static QString buildProfileName(Mixer* mixer, QString profileName, bool \
allowFallback); static void addProfile(GUIProfile* guiprof);
static QMap<QString, GUIProfile*> s_profiles;
--- branches/work/kmix/kmix.cpp #1144419:1144420
@@ -298,7 +298,7 @@
QListIterator<Mixer*> it(Mixer::mixers());
while ( it.hasNext()) {
Mixer* mixer = it.next();
- mixerViews[mixer->id()];
+ mixerViews[mixer->id()]; // just insert a map entry
}
// -1- Save the views themselves
@@ -562,11 +562,15 @@
static int dummyToggler = false;
dummyToggler = !dummyToggler;
GUIProfile* guiprof;
+ QString profileName;
+
if ( dummyToggler ) {
- guiprof = GUIProfile::find(mixer, "playback", allowDefault);
+ profileName = GUIProfile::buildProfileName(mixer, QString("playback"), \
false); + guiprof = GUIProfile::find(mixer, profileName, allowDefault);
}
else {
- guiprof = GUIProfile::find(mixer, "capture", allowDefault);
+ profileName = GUIProfile::buildProfileName(mixer, QString("capture"), \
false); + guiprof = GUIProfile::find(mixer, profileName, allowDefault);
}
if ( guiprof == 0 ) {
--- branches/work/kmix/mixdevice.cpp #1144419:1144420
@@ -72,6 +72,8 @@
return "mixer-microphone-front-boost";
case MixDevice::MICROPHONE_FRONT:
return "mixer-microphone-front";
+ case MixDevice::KMIX_COMPOSITE:
+ return "mixer-line";
}
return "mixer-front";
}
--- branches/work/kmix/mixdevicecomposite.cpp #1144419:1144420
@@ -24,7 +24,7 @@
-MixDeviceComposite::MixDeviceComposite( Mixer* mixer, const QString& id, \
QList<MixDevice*> mds, const QString& name, ChannelType type ) : \
+MixDeviceComposite::MixDeviceComposite( Mixer* mixer, const QString& id, \
QList<MixDevice*>& mds, const QString& name, ChannelType type ) : MixDevice( mixer, \
id, name, type ) {
// use a standard init(), but as this is a Composite Control, use doNotRestore \
== true
--- branches/work/kmix/mixdevicecomposite.h #1144419:1144420
@@ -75,7 +75,7 @@
* @par name is the readable name. This one is presented to the user in the GUI
* @par type The control type. It is only used to find an appropriate icon
*/
- MixDeviceComposite( Mixer* mixer, const QString& id, QList<MixDevice*> mds, \
const QString& name, ChannelType type ); + MixDeviceComposite( Mixer* mixer, const \
QString& id, QList<MixDevice*>& mds, const QString& name, ChannelType type ); // \
MixDevice( Mixer* mixer, const QString& id, const QString& name, const QString& \
iconName = "", bool doNotRestore = false, MixSet* moveDestinationMixSet = 0 ); \
~MixDeviceComposite();
--- branches/work/kmix/viewbase.cpp #1144419:1144420
@@ -245,11 +245,13 @@
if ( new_mix_devices.count() > 0 ) {
kDebug(67100) << "Found " << new_mix_devices.count() << " new \
controls. Adding to GUIProfile"; while ( new_mix_devices.count() > 0 ) {
- ProfControl* ctl = new ProfControl();
- ctl->id = new_mix_devices.takeAt(0);
- ctl->setSubcontrols(QString("*"));
- ctl->tab = (_guiprof->tabs())[0]->name(); // Use the first \
tab... not ideal but should work most of the time;
- ctl->show = "simple";
+ QString sctlMatchAll("*");
+ QString new_mix_devices0 = new_mix_devices.takeAt(0);
+ ProfControl* ctl = new ProfControl(new_mix_devices0, \
sctlMatchAll); +// ctl->id = new_mix_devices.takeAt(0);
+// ctl->setSubcontrols(QString("*"));
+// ctl->tab = (_guiprof->tabs())[0]->name(); // Use the first \
tab... not ideal but should work most of the time; +// ctl->show = \
"simple"; _guiprof->_controls.push_back(ctl);
}
_guiprof->setDirty();
--- branches/work/kmix/viewsliders.cpp #1144419:1144420
@@ -154,7 +154,7 @@
for ( std::vector<ProfControl*>::const_iterator it = \
_guiprof->_controls.begin(); it != itEnd; ++it) {
ProfControl* control = *it;
- if ( control->tab == id() ) {
+ if ( true /*control->tab == id() */ ) {
// The TabName of the control matches this View name (!! attention: \
Better use some ID, due to i18n() ) bool isUsed = false;
@@ -213,8 +213,9 @@
Volume::ChannelMask chn = Volume::MMAIN;
Volume* vol = new Volume( chn, 0, 100, true, true);
mdc->addPlaybackVolume(*vol);
- ProfControl* pctl = new ProfControl();
- pctl->setSubcontrols("*");
+ QString ctlId("Composite_Test");
+ QString ctlMatchAll("*");
+ ProfControl* pctl = new ProfControl(ctlId, ctlMatchAll);
mdc->setControlProfile(pctl);
_mixSet->append(mdc);
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic