added percentage label to represent mid handle position (to enhance)

This commit is contained in:
Paolo Cignoni cignoni 2008-03-19 16:10:21 +00:00
parent 2631fd3c63
commit 7d2c75c512
4 changed files with 57 additions and 3 deletions

View File

@ -104,8 +104,10 @@ signals:
private slots:
void setXBySpinBoxValueChanged (double spinBoxValue); // changing equalizer spinboxes moves the connected handle
void moveMidHandle();
public slots:
void setXBySpinBoxValueChanged (double spinBoxValue); // changing equalizer spinboxes moves the connected handle
};
#endif // EQHANDLE_H

View File

@ -63,6 +63,7 @@ QualityMapperDialog::QualityMapperDialog(QWidget *parent, MeshModel& m, GLArea *
_equalizer_histogram = 0;
for (int i=0; i<NUMBER_OF_EQHANDLES; i++)
_equalizerHandles[i] = 0;
_signalDir = UNKNOWN_DIRECTION;
//building default Transfer Function
_transferFunction = new TransferFunction( STARTUP_TF_TYPE );
@ -341,6 +342,7 @@ bool QualityMapperDialog::initEqualizerHistogram()
// Connecting handles to spinboxes
connect(_equalizerHandles[LEFT_HANDLE], SIGNAL(positionChangedToSpinBox(double)), ui.minSpinBox, SLOT(setValue(double)));
connect(_equalizerHandles[MID_HANDLE], SIGNAL(positionChangedToSpinBox(double)), ui.midSpinBox, SLOT(setValue(double)));
connect(_equalizerHandles[MID_HANDLE], SIGNAL(positionChangedToSpinBox(double)), this, SLOT(on_midSpinBox_valueChanged(double)));
connect(_equalizerHandles[RIGHT_HANDLE], SIGNAL(positionChangedToSpinBox(double)), ui.maxSpinBox, SLOT(setValue(double)));
// Connecting left and right handles to mid handle
@ -1340,4 +1342,37 @@ void QualityMapperDialog::setEqualizerParameters(EQUALIZER_INFO data)
void QualityMapperDialog::on_brightnessSlider_valueChanged(int value)
{
ui.brightessSpinBox->setValue((double)value/50.0);
}
void QualityMapperDialog::on_midSpinBox_valueChanged(double)
{
if ( _signalDir != LABEL2SPINBOX )
ui.midPercentage->blockSignals( true );
QString val;
val.setNum( 100.0f * absolute2RelativeValf( ui.midSpinBox->value(), ui.maxSpinBox->value() - ui.minSpinBox->value() ), 'g', 4 );
ui.midPercentage->setText( val + "%" );
if ( _signalDir != LABEL2SPINBOX )
ui.midPercentage->blockSignals( false );
_signalDir = SPINBOX2LABEL;
}
void QualityMapperDialog::on_midPercentage_textEdited(QString newText)
{
bool conversionPossible;
float numericValue = newText.toFloat(&conversionPossible);
if ( _signalDir != SPINBOX2LABEL )
ui.midSpinBox->blockSignals( true );
if ((conversionPossible) && (numericValue>=0) && (numericValue<=100) )
{
ui.midSpinBox->setValue( relative2AbsoluteValf(numericValue, ui.maxSpinBox->value() - ui.minSpinBox->value()) / 100.0f );
_equalizerHandles[MID_HANDLE]->setXBySpinBoxValueChanged(ui.midSpinBox->value());
}
else
QMessageBox::warning(this, tr("Wrong text value"), tr("The value inserted in the text area has a bad range value or is of a not compatible type"), QMessageBox::Ok);
if ( _signalDir != SPINBOX2LABEL )
ui.midSpinBox->blockSignals( false );
_signalDir = LABEL2SPINBOX;
}

View File

@ -100,6 +100,13 @@ public:
#define GRAPHICS_ITEMS_LIST QList<QGraphicsItem *>
#define TF_HANDLES_LIST QList<TFHandle*>
enum MID_HANDLE_SIGNAL_DIRECTION
{
UNKNOWN_DIRECTION = 0,
SPINBOX2LABEL,
LABEL2SPINBOX
};
//this class define the dialog of the plugin
class QualityMapperDialog : public QDockWidget
{
@ -127,6 +134,7 @@ private:
bool _leftHandleWasInsideHistogram;
bool _rightHandleWasInsideHistogram;
GRAPHICS_ITEMS_LIST _equalizerHistogramBars;
MID_HANDLE_SIGNAL_DIRECTION _signalDir;
//Transfer Function items
TransferFunction *_transferFunction;
@ -170,6 +178,8 @@ signals:
void closingDialog();
private slots:
void on_midPercentage_textEdited(QString);
void on_midSpinBox_valueChanged(double);
void on_brightnessSlider_valueChanged(int);
void on_clampButton_clicked();
void on_ySpinBox_valueChanged(double);

View File

@ -534,7 +534,7 @@
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<width>16</width>
<height>20</height>
</size>
</property>
@ -553,6 +553,13 @@
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="midPercentage" >
<property name="text" >
<string>%</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
@ -560,7 +567,7 @@
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<width>16</width>
<height>20</height>
</size>
</property>