1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

OP-278 Prevent the user from entering red/yellow/green ranges inconsistent with the overall range.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2460 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
edouard 2011-01-16 23:02:18 +00:00 committed by edouard
parent c2bdf624e8
commit 85e16cf633
2 changed files with 31 additions and 1 deletions

View File

@ -55,6 +55,9 @@ QWidget *LineardialGadgetOptionsPage::createPage(QWidget *parent)
//main layout
options_page->setupUi(optionsPageWidget);
connect(options_page->minValue, SIGNAL(valueChanged(double)), this, SLOT(on_rangeMin_valueChanged(double)));
connect(options_page->maxValue, SIGNAL(valueChanged(double)), this, SLOT(on_rangeMax_valueChanged(double)));
// Restore the contents from the settings:
options_page->svgSourceFile->setExpectedKind(Utils::PathChooser::File);
options_page->svgSourceFile->setPromptDialogFilter(tr("SVG image (*.svg)"));
@ -99,6 +102,29 @@ QWidget *LineardialGadgetOptionsPage::createPage(QWidget *parent)
return optionsPageWidget;
}
/**
* Used to make sure the green/yellow/red ranges are consistent
* with the overall dial range
*/
void LineardialGadgetOptionsPage::on_rangeMin_valueChanged(double val)
{
options_page->greenMin->setMinimum(val);
options_page->yellowMin->setMinimum(val);
options_page->redMin->setMinimum(val);
}
/**
* Used to make sure the green/yellow/red ranges are consistent
* with the overall dial range
*/
void LineardialGadgetOptionsPage::on_rangeMax_valueChanged(double val)
{
options_page->greenMax->setMaximum(val);
options_page->yellowMax->setMaximum(val);
options_page->redMax->setMaximum(val);
}
/**
* Called when the user presses apply or OK.
*
@ -108,7 +134,9 @@ QWidget *LineardialGadgetOptionsPage::createPage(QWidget *parent)
void LineardialGadgetOptionsPage::apply()
{
m_config->setDialFile(options_page->svgSourceFile->path());
m_config->setRange(options_page->minValue->value(),options_page->maxValue->value());
double rangeMin = options_page->minValue->value();
double rangeMax = options_page->maxValue->value();
m_config->setRange(rangeMin,rangeMax);
m_config->setGreenRange(options_page->greenMin->value(),options_page->greenMax->value());
m_config->setYellowRange(options_page->yellowMin->value(),options_page->yellowMax->value());
m_config->setRedRange(options_page->redMin->value(),options_page->redMax->value());

View File

@ -64,6 +64,8 @@ private:
private slots:
void on_fontPicker_clicked();
void on_objectName_currentIndexChanged(QString val);
void on_rangeMin_valueChanged(double val);
void on_rangeMax_valueChanged(double val);
};