Commit efb7ffe3 authored by Mark Kretschmann's avatar Mark Kretschmann Committed by Vedant Agarwala
Browse files

Hide preamp in EQ when Phonon backend does not support it.

Prevents some confusion.

BUG: 324976
parent 2f01af3a
......@@ -156,7 +156,7 @@ EngineController::initializePhonon()
// Add an equalizer effect if available
QList<EffectDescription> effects = BackendCapabilities::availableAudioEffects();
QRegExp equalizerRegExp( QString( "equalizer.*%1.*bands" ).arg( s_equalizerBandsCount ),
QRegExp equalizerRegExp( QString( "equalizer.*%1.*bands" ).arg( s_equalizerBandsNum ),
Qt::CaseInsensitive );
foreach( const EffectDescription &description, effects )
{
......@@ -165,7 +165,7 @@ EngineController::initializePhonon()
QScopedPointer<Effect> equalizer( new Effect( description, this ) );
int parameterCount = equalizer->parameters().count();
if( parameterCount == s_equalizerBandsCount || parameterCount == s_equalizerBandsCount + 1 )
if( parameterCount == s_equalizerBandsNum || parameterCount == s_equalizerBandsNum + 1 )
{
debug() << "Established Phonon equalizer effect with" << parameterCount
<< "parameters.";
......@@ -884,7 +884,7 @@ EngineController::eqUpdate() //SLOT
QListIterator<int> equalizerParametersIt( equalizerParametersCfg );
double scaledVal; // Scaled value to set from universal -100 - 100 range to plugin scale
// Checking if preamp is present in equalizer parameters
if( equalizerParameters.size() == s_equalizerBandsCount )
if( equalizerParameters.size() == s_equalizerBandsNum )
{
// If pre-amp is not present then skip the first element of equalizer gain
if( equalizerParametersIt.hasNext() )
......
......@@ -40,7 +40,7 @@
#include <Phonon/EffectParameter>
#include <phonon/audiodataoutput.h>
static const int s_equalizerBandsCount = 10; // Number of equalizer parameters excluding Preamp
static const int s_equalizerBandsNum = 10; // Number of equalizer parameters excluding Preamp
class Fadeouter;
namespace Capabilities { class MultiPlayableCapability; class MultiSourceCapability; }
......
......@@ -89,16 +89,21 @@ EqualizerDialog::EqualizerDialog( QWidget* parent )
// Ask engine for maximum gain value and compute scale to display values
mValueScale = The::engineController()->eqMaxGain();
QString mlblText = i18n( "%0\ndB" ).arg( QString::number( mValueScale, 'f', 1 ) );
const QString mlblText = i18n( "%0\ndB" ).arg( QString::number( mValueScale, 'f', 1 ) );
eqMaxEq->setText( QString("+") + mlblText );
eqMinEq->setText( QString("-") + mlblText );
// Ask engine for band frequencies and set labels
QStringList equalizerBandFreq = The::engineController()->eqBandsFreq();
const QStringList equalizerBandFreq = The::engineController()->eqBandsFreq();
QStringListIterator i( equalizerBandFreq );
// Checking if preamp is present
if( equalizerBandFreq.size() == s_equalizerBandsCount )
eqPreampSlider->setDisabled( true );
// Check if preamp is supported by Phonon backend
if( equalizerBandFreq.size() == s_equalizerBandsNum ) {
// Preamp not supported, so hide its slider
eqPreampLabel->hide();
eqPreampSlider->hide();
eqPreampValue->hide();
}
else if( i.hasNext() ) // If preamp is present then skip its label as it is hard-coded in UI
i.next();
foreach( QLabel* mLabel, m_bandLabels )
......
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