SVN commit 1270944 by esken: krazy-check: Fix single-char QString operations for efficiency [doublequote_chars] M +1 -1 apps/kmix.cpp M +2 -2 backends/mixer_alsa9.cpp M +2 -2 backends/mixer_mpris2.cpp M +1 -1 backends/mixer_oss4.cpp M +1 -1 core/kmixdevicemanager.cpp M +5 -5 core/mixer.cpp M +1 -1 gui/dialogviewconfiguration.cpp M +10 -10 gui/guiprofile.cpp M +1 -1 gui/kmixerwidget.cpp M +14 -21 gui/mdwslider.cpp M +0 -1 gui/viewsliders.cpp M +3 -3 plasma/engine/mixerengine.cpp --- trunk/KDE/kdemultimedia/kmix/apps/kmix.cpp #1270943:1270944 @@ -1191,7 +1191,7 @@ msg += startErrorMessage; msg += "\n("; msg += args.join( QLatin1String( " " )); - msg += ")"; + msg += ')'; errorPopup(msg); } --- trunk/KDE/kdemultimedia/kmix/backends/mixer_alsa9.cpp #1270943:1270944 @@ -158,7 +158,7 @@ QString mdID("%1:%2"); mdID = mdID.arg(snd_mixer_selem_id_get_name ( sid ) ) .arg(snd_mixer_selem_id_get_index( sid ) ); - mdID.replace(" ","_"); // Any key/ID we use, must not uses spaces (rule) + mdID.replace(' ','_'); // Any key/ID we use, must not uses spaces (rule) MixDevice::ChannelType ct = (MixDevice::ChannelType)identify( sid ); @@ -186,7 +186,7 @@ // Add a number to the control name, like "PCM 2", when the index is > 0 QString idxString; idxString.setNum(1+controlInstanceIndex); - readableName += " "; + readableName += ' '; readableName += idxString; } --- trunk/KDE/kdemultimedia/kmix/backends/mixer_mpris2.cpp #1270943:1270944 @@ -356,12 +356,12 @@ /** * This slot is a simple proxy that enriches the DBUS signal with our data, which especially contains the id of the MixDevice. */ -void MPrisAppdata::volumeChangedIncoming(QString ifc,QVariantMap msg ,QStringList sl) +void MPrisAppdata::volumeChangedIncoming(QString /*ifc*/,QVariantMap msg ,QStringList /*sl*/) { QMap::iterator v = msg.find("Volume"); if (v != msg.end() ) { - kDebug(67100) << "volumeChanged incoming: !!!!!!!!!" ; +// kDebug(67100) << "volumeChanged incoming: !!!!!!!!!" ; double volDouble = v.value().toDouble(); emit volumeChanged( this, volDouble); } --- trunk/KDE/kdemultimedia/kmix/backends/mixer_oss4.cpp #1270943:1270944 @@ -54,7 +54,7 @@ bool Mixer_OSS4::CheckCapture(oss_mixext *ext) { QString name = ext->extname; - if ( ext->flags & MIXF_RECVOL || name.split(".").contains("in") ) + if ( ext->flags & MIXF_RECVOL || name.split('.').contains("in") ) { return true; } --- trunk/KDE/kdemultimedia/kmix/core/kmixdevicemanager.cpp #1270943:1270944 @@ -141,7 +141,7 @@ dev = devExpr.cap(1); // Get device number from device name (e.g "/dev/mixer1" or "/dev/sound/mixer2") } else { - dev = "0"; // "/dev/mixer" or "/dev/sound/mixer" + dev = '0'; // "/dev/mixer" or "/dev/sound/mixer" } emit plugged("OSS", udi, dev); } --- trunk/KDE/kdemultimedia/kmix/core/mixer.cpp #1270943:1270944 @@ -130,16 +130,16 @@ * %3, the mixer number, is a number: it does not contain colons. */ QString mixerName = getBaseName(); - mixerName.replace(":","_"); + mixerName.replace(':','_'); QString primaryKeyOfMixer = QString("%1::%2:%3") .arg(getDriverName()) .arg(mixerName) .arg(_cardInstance); // The following 3 replaces are for not messing up the config file - primaryKeyOfMixer.replace("]","_"); - primaryKeyOfMixer.replace("[","_"); // not strictly necessary, but lets play safe - primaryKeyOfMixer.replace(" ","_"); - primaryKeyOfMixer.replace("=","_"); + primaryKeyOfMixer.replace(']','_'); + primaryKeyOfMixer.replace('[','_'); // not strictly necessary, but lets play safe + primaryKeyOfMixer.replace(' ','_'); + primaryKeyOfMixer.replace('=','_'); _id = primaryKeyOfMixer; } --- trunk/KDE/kdemultimedia/kmix/gui/dialogviewconfiguration.cpp #1270943:1270944 @@ -381,7 +381,7 @@ if ( ctlId.contains(idRegexp) ) { // found. Create a copy ProfControl* newCtl = new ProfControl(*control); - newCtl->id = "^" + ctlId + "$"; // Replace the (possible generic) regexp by the actual ID + newCtl->id = '^' + ctlId + '$'; // Replace the (possible generic) regexp by the actual ID // We have made this an an actual control. As it is derived (from e.g. ".*") it is NOT mandatory. newCtl->setMandatory(false); if ( isActiveView ) { --- trunk/KDE/kdemultimedia/kmix/gui/guiprofile.cpp #1270943:1270944 @@ -118,9 +118,9 @@ fname += ".%1.%2"; fname = fname.arg(mixer->getBaseName()).arg(mixer->getCardInstance()); } - fname += "." + profileName; + fname += '.' + profileName; - fname.replace(" ","_"); + fname.replace(' ','_'); return fname; } @@ -133,10 +133,10 @@ QString fname; fname += mixer->getBaseName(); if ( mixer->getCardInstance() > 1 ) { - fname += " " + mixer->getCardInstance(); + fname += ' ' + mixer->getCardInstance(); } if ( profileName != "default" ) { - fname += " " + profileName; + fname += ' ' + profileName; } return fname; @@ -322,7 +322,7 @@ bool ret = false; QString fileName, fileNameFQ; fileName = "profiles/" + getId() + ".xml"; - fileName.replace(":", "."); + fileName.replace(':', '.'); fileNameFQ = KStandardDirs::locateLocal("appdata", fileName, true ); kDebug() << "Write profile:" << fileNameFQ ; @@ -424,9 +424,9 @@ QString xmlify(QString raw) { // kDebug() << "Before: " << raw; - raw = raw.replace("&", "&"); - raw = raw.replace("<", "<"); - raw = raw.replace(">", ">"); + raw = raw.replace('&', "&"); + raw = raw.replace('<', "<"); + raw = raw.replace('>', ">"); raw = raw.replace("'", "'"); raw = raw.replace("\"", """); // kDebug() << "After : " << raw; @@ -777,7 +777,7 @@ if ( !id.isNull() ) { // We need at least an "id". We can set defaults for the rest, if undefined. if ( subcontrols.isNull() || subcontrols.isEmpty() ) { - subcontrols = "*"; // for compatibility reasons, we interpret an empty string as match-all (aka "*") + subcontrols = '*'; // for compatibility reasons, we interpret an empty string as match-all (aka "*") } if ( name.isNull() ) { // ignore. isNull() will be checked by all users. @@ -793,7 +793,7 @@ } ProfControl *profControl = new ProfControl(id, subcontrols); - if ( show.isNull() ) { show = "*"; } + if ( show.isNull() ) { show = '*'; } profControl->name = name; profControl->show = show; --- trunk/KDE/kdemultimedia/kmix/gui/kmixerwidget.cpp #1270943:1270944 @@ -105,7 +105,7 @@ * 2c) Add Views to Tab ********************************************************************/ ViewSliders* view = new ViewSliders( this, _guiprof->getId().toLatin1(), _mixer, vflags, _guiprof, _actionCollection ); - bool added = possiblyAddView(view); + possiblyAddView(view); show(); // kDebug(67100) << "KMixerWidget::createLayout(): EXIT\n"; } --- trunk/KDE/kdemultimedia/kmix/gui/mdwslider.cpp #1270943:1270944 @@ -554,7 +554,7 @@ QWidget *subcontrolLabel; QString subcontrolTranslation; - if ( type == 'c' ) subcontrolTranslation += i18n("Capture") + " "; + if ( type == 'c' ) subcontrolTranslation += i18n("Capture") + ' '; subcontrolTranslation += Volume::ChannelNameReadable[vc.chid]; //Volume::getSubcontrolTranslation(chid); subcontrolLabel = createLabel(this, subcontrolTranslation, volLayout, true); @@ -866,43 +866,35 @@ void MDWSlider::volumeChangeInternal( Volume& vol, QList& ref_sliders ) { - - // --- Step 2: Change the volumes directly in the Volume object to reflect the Sliders --- if ( isStereoLinked() ) { QAbstractSlider* firstSlider = ref_sliders.first(); - long firstVolume = firstSlider->value(); - //kDebug(67100) << "firstVolume=" <value(); - //kDebug(67100) << "firstVolume=" <value()); + } + else + { + for( int i=0; ivalue()); } // iterate over all sliders - } // !stereoLinked() - - // --- Step 3: Write back the new volumes to the HW --- } +} /** This slot is called, when a user has clicked the recsrc button. Also it is called by any other associated KAction like the context menu. */ -void MDWSlider::toggleRecsrc() { +void MDWSlider::toggleRecsrc() +{ setRecsrc( m_mixdevice->isRecSource() ); } void MDWSlider::setRecsrc(bool value ) { - if ( m_mixdevice->captureVolume().hasSwitch() ) { + if ( m_mixdevice->captureVolume().hasSwitch() ) + { m_mixdevice->setRecSource( value ); m_mixdevice->mixer()->commitVolumeChange( m_mixdevice ); } @@ -913,7 +905,8 @@ This slot is called, when a user has clicked the mute button. Also it is called by any other associated KAction like the context menu. */ -void MDWSlider::toggleMuted() { +void MDWSlider::toggleMuted() +{ setMuted( !m_mixdevice->isMuted() ); } --- trunk/KDE/kdemultimedia/kmix/gui/viewsliders.cpp #1270943:1270944 @@ -216,7 +216,6 @@ bool subcontrolCaptureWanted = (control->useSubcontrolCapture() && ( md->captureVolume() .hasVolume() || md->captureVolume() .hasSwitch()) ); bool subcontrolEnumWanted = (control->useSubcontrolEnum() && md->isEnum()); bool subcontrolWanted = subcontrolPlaybackWanted | subcontrolCaptureWanted | subcontrolEnumWanted; - bool splitWanted = control->isSplit(); if ( !subcontrolWanted ) continue; --- trunk/KDE/kdemultimedia/kmix/plasma/engine/mixerengine.cpp #1270943:1270944 @@ -133,7 +133,7 @@ Q_FOREACH( ControlInfo* ci, m_controls ) { if ( removeSources ) - removeSource( ci->mixerId + "/" + ci->id ); + removeSource( ci->mixerId + '/' + ci->id ); delete ci->iface; delete ci; } @@ -266,7 +266,7 @@ Q_FOREACH( ControlInfo* ci, m_controls.values( curmi->id ) ) if ( ci->updateRequired ) { - QString source = ci->mixerId + "/" + ci->id; + QString source = ci->mixerId + '/' + ci->id; setData( source, "Can Be Muted", ci->iface->canMute() ); setData( source, "Volume", ci->iface->volume() ); setData( source, "Mute", ci->iface->mute() ); @@ -344,7 +344,7 @@ Q_FOREACH( ControlInfo* ci, m_controls.values( mi->id ) ) { m_controls.remove( mi->id, ci ); - removeSource( ci->mixerId + "/" + ci->id ); + removeSource( ci->mixerId + '/' + ci->id ); delete ci->iface; delete ci; }