30 #include "ui_lineardialgadgetoptionspage.h"
35 #include <QFileDialog>
36 #include <QtAlgorithms>
37 #include <QStringList>
38 #include <QFontDialog>
42 : IOptionsPage(parent)
45 font = QFont(
"Arial", 12);
53 options_page =
new Ui::LineardialGadgetOptionsPage();
55 QWidget *optionsPageWidget =
new QWidget;
57 options_page->setupUi(optionsPageWidget);
60 options_page->svgSourceFile->setExpectedKind(Utils::PathChooser::File);
61 options_page->svgSourceFile->setPromptDialogFilter(tr(
"SVG image (*.svg)"));
62 options_page->svgSourceFile->setPromptDialogTitle(tr(
"Choose SVG image"));
63 options_page->svgSourceFile->setPath(m_config->
getDialFile());
64 options_page->minValue->setValue(m_config->
getMin());
65 options_page->maxValue->setValue(m_config->
getMax());
68 on_rangeMin_valueChanged(m_config->
getMin());
69 on_rangeMax_valueChanged(m_config->
getMax());
70 options_page->greenMin->setValue(m_config->
getGreenMin());
71 options_page->greenMax->setValue(m_config->
getGreenMax());
72 options_page->yellowMin->setValue(m_config->
getYellowMin());
73 options_page->yellowMax->setValue(m_config->
getYellowMax());
74 options_page->redMin->setValue(m_config->
getRedMin());
75 options_page->redMax->setValue(m_config->
getRedMax());
76 options_page->factor->setValue(m_config->
getFactor());
78 font.fromString(m_config->
getFont());
84 foreach (QVector<UAVDataObject *> list, objList) {
86 options_page->objectName->addItem(obj->
getName());
91 options_page->objectName->setCurrentIndex(
99 options_page->objectField->setCurrentIndex(
104 connect(options_page->objectName, SIGNAL(currentIndexChanged(QString)),
this,
105 SLOT(on_objectName_currentIndexChanged(QString)));
106 connect(options_page->fontPicker, SIGNAL(clicked()),
this, SLOT(on_fontPicker_clicked()));
107 connect(options_page->minValue, SIGNAL(valueChanged(
double)),
this,
108 SLOT(on_rangeMin_valueChanged(
double)));
109 connect(options_page->maxValue, SIGNAL(valueChanged(
double)),
this,
110 SLOT(on_rangeMax_valueChanged(
double)));
112 return optionsPageWidget;
119 void LineardialGadgetOptionsPage::on_rangeMin_valueChanged(
double val)
121 options_page->maxValue->setMinimum(val);
123 options_page->greenMin->setMinimum(val);
124 options_page->yellowMin->setMinimum(val);
125 options_page->redMin->setMinimum(val);
127 options_page->greenMax->setMinimum(val);
128 options_page->yellowMax->setMinimum(val);
129 options_page->redMax->setMinimum(val);
136 void LineardialGadgetOptionsPage::on_rangeMax_valueChanged(
double val)
138 options_page->minValue->setMaximum(val);
140 options_page->greenMax->setMaximum(val);
141 options_page->yellowMax->setMaximum(val);
142 options_page->redMax->setMaximum(val);
144 options_page->greenMin->setMaximum(val);
145 options_page->yellowMin->setMaximum(val);
146 options_page->redMin->setMaximum(val);
157 m_config->
setDialFile(options_page->svgSourceFile->path());
158 double rangeMin = options_page->minValue->value();
159 double rangeMax = options_page->maxValue->value();
160 m_config->
setRange(rangeMin, rangeMax);
161 m_config->
setGreenRange(options_page->greenMin->value(), options_page->greenMax->value());
162 m_config->
setYellowRange(options_page->yellowMin->value(), options_page->yellowMax->value());
163 m_config->
setRedRange(options_page->redMin->value(), options_page->redMax->value());
166 m_config->
setFont(font.toString());
168 m_config->
setFactor(options_page->factor->value());
175 void LineardialGadgetOptionsPage::on_fontPicker_clicked()
178 font = QFontDialog::getFont(&ok, font, qobject_cast<QWidget *>(
this));
185 void LineardialGadgetOptionsPage::on_objectName_currentIndexChanged(QString val)
187 options_page->objectField->clear();
195 options_page->objectField->addItem(field->
getName() +
"-" + elemName);
198 options_page->objectField->addItem(field->
getName());
void setFactor(double val)
void setRedRange(double min, double max)
void setFont(QString text)
Core plugin system that manages the plugins, their life cycle and their registered objects...
void setSourceObjField(QString text)
void setDialFile(QString filename)
QString getSourceObjectField()
QWidget * createPage(QWidget *parent)
void setYellowRange(double min, double max)
void setSourceDataObject(QString text)
void setGreenRange(double min, double max)
QStringList getElementNames() const
LineardialGadgetOptionsPage(LineardialGadgetConfiguration *config, QObject *parent=nullptr)
void setRange(double min, double max)
UAVObject * getObject(const QString &name, quint32 instId=0)
QVector< QVector< UAVDataObject * > > getDataObjectsVector()
void setDecimalPlaces(int val)
QString getSourceDataObject()