mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
Made openGL option default to not used, added smooth option to dials plugin
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2615 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
8236bf8e19
commit
e5e80bde27
@ -54,6 +54,7 @@ void DialGadget::loadConfiguration(IUAVGadgetConfiguration* config)
|
||||
m->getN3Move());
|
||||
|
||||
m_widget->enableOpenGL(m->useOpenGL());
|
||||
m_widget->enableSmoothUpdates(m->getBeSmooth());
|
||||
|
||||
m_widget->setN1Min(m->getN1Min());
|
||||
m_widget->setN1Max(m->getN1Max());
|
||||
|
@ -36,7 +36,7 @@
|
||||
DialGadgetConfiguration::DialGadgetConfiguration(QString classId, QSettings* qSettings, QObject *parent) :
|
||||
IUAVGadgetConfiguration(classId, parent),
|
||||
m_defaultDial("Unknown"),
|
||||
dialBackgroundID("background"),
|
||||
dialBackgroundID("background"),
|
||||
dialForegroundID("foreground"),
|
||||
dialNeedleID1("needle"),
|
||||
dialNeedleID2("needle2"),
|
||||
@ -52,14 +52,14 @@ DialGadgetConfiguration::DialGadgetConfiguration(QString classId, QSettings* qSe
|
||||
needle3Factor(1),
|
||||
needle1Move("Rotate"),
|
||||
needle2Move("Rotate"),
|
||||
needle3Move("Rotate")
|
||||
needle3Move("Rotate"),
|
||||
useOpenGLFlag(false),
|
||||
beSmooth(true)
|
||||
{
|
||||
//if a saved configuration exists load it
|
||||
if(qSettings != 0) {
|
||||
QString dialFile = qSettings->value("dialFile").toString();
|
||||
|
||||
useOpenGLFlag = qSettings->value("useOpenGLFlag").toBool();
|
||||
|
||||
m_defaultDial=Utils::PathUtils().InsertDataPath(dialFile);
|
||||
dialBackgroundID = qSettings->value("dialBackgroundID").toString();
|
||||
dialForegroundID = qSettings->value("dialForegroundID").toString();
|
||||
@ -85,7 +85,9 @@ DialGadgetConfiguration::DialGadgetConfiguration(QString classId, QSettings* qSe
|
||||
needle2Move = qSettings->value("needle2Move").toString();
|
||||
needle3Move = qSettings->value("needle3Move").toString();
|
||||
font = qSettings->value("font").toString();
|
||||
}
|
||||
useOpenGLFlag = qSettings->value("useOpenGLFlag").toBool();
|
||||
beSmooth = qSettings->value("beSmooth").toBool();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -95,7 +97,6 @@ DialGadgetConfiguration::DialGadgetConfiguration(QString classId, QSettings* qSe
|
||||
IUAVGadgetConfiguration *DialGadgetConfiguration::clone()
|
||||
{
|
||||
DialGadgetConfiguration *m = new DialGadgetConfiguration(this->classId());
|
||||
m->useOpenGLFlag = useOpenGLFlag;
|
||||
m->m_defaultDial=m_defaultDial;
|
||||
m->setDialBackgroundID(dialBackgroundID);
|
||||
m->setDialForegroundID(dialForegroundID);
|
||||
@ -121,6 +122,8 @@ IUAVGadgetConfiguration *DialGadgetConfiguration::clone()
|
||||
m->setN2Move(needle2Move);
|
||||
m->setN3Move(needle3Move);
|
||||
m->setFont(font);
|
||||
m->useOpenGLFlag = useOpenGLFlag;
|
||||
m->beSmooth = beSmooth;
|
||||
|
||||
return m;
|
||||
}
|
||||
@ -133,8 +136,6 @@ void DialGadgetConfiguration::saveConfig(QSettings* settings) const {
|
||||
QString dialFile = Utils::PathUtils().RemoveDataPath(m_defaultDial);
|
||||
settings->setValue("dialFile", dialFile);
|
||||
|
||||
settings->setValue("useOpenGLFlag", useOpenGLFlag);
|
||||
|
||||
settings->setValue("dialBackgroundID", dialBackgroundID);
|
||||
settings->setValue("dialForegroundID", dialForegroundID);
|
||||
|
||||
@ -165,4 +166,7 @@ void DialGadgetConfiguration::saveConfig(QSettings* settings) const {
|
||||
settings->setValue("needle3Move", needle3Move);
|
||||
|
||||
settings->setValue("font", font);
|
||||
|
||||
settings->setValue("useOpenGLFlag", useOpenGLFlag);
|
||||
settings->setValue("beSmooth", beSmooth);
|
||||
}
|
||||
|
@ -70,6 +70,7 @@ public:
|
||||
void setN3Move( QString move) { needle3Move = move; }
|
||||
void setFont(QString text) { font = text; }
|
||||
void setUseOpenGL(bool flag) { useOpenGLFlag = flag; }
|
||||
void setBeSmooth(bool flag) { beSmooth = flag;}
|
||||
|
||||
|
||||
//get dial configuration functions
|
||||
@ -99,6 +100,7 @@ public:
|
||||
QString getN3Move() { return needle3Move; }
|
||||
QString getFont() { return font;}
|
||||
bool useOpenGL() { return useOpenGLFlag; }
|
||||
bool getBeSmooth() { return beSmooth; }
|
||||
|
||||
void saveConfig(QSettings* settings) const;
|
||||
IUAVGadgetConfiguration *clone();
|
||||
@ -138,6 +140,7 @@ private:
|
||||
QString needle3Move;
|
||||
|
||||
bool useOpenGLFlag;
|
||||
bool beSmooth;
|
||||
};
|
||||
|
||||
#endif // DIALGADGETCONFIGURATION_H
|
||||
|
@ -82,8 +82,6 @@ QWidget *DialGadgetOptionsPage::createPage(QWidget *parent)
|
||||
|
||||
// Restore the contents from the settings:
|
||||
|
||||
options_page->useOpenGL->setChecked(m_config->useOpenGL());
|
||||
|
||||
options_page->svgSourceFile->setExpectedKind(Utils::PathChooser::File);
|
||||
options_page->svgSourceFile->setPromptDialogFilter(tr("SVG image (*.svg)"));
|
||||
options_page->svgSourceFile->setPromptDialogTitle(tr("Choose SVG image"));
|
||||
@ -106,6 +104,10 @@ QWidget *DialGadgetOptionsPage::createPage(QWidget *parent)
|
||||
options_page->moveNeedle2->setCurrentIndex(options_page->moveNeedle2->findText(m_config->getN2Move()));
|
||||
options_page->moveNeedle3->setCurrentIndex(options_page->moveNeedle3->findText(m_config->getN3Move()));
|
||||
|
||||
options_page->useOpenGL->setChecked(m_config->useOpenGL());
|
||||
options_page->smoothUpdates->setChecked(m_config->getBeSmooth());
|
||||
|
||||
|
||||
//select saved UAV Object field values
|
||||
if(options_page->uavObject1->findText(m_config->getN1DataObject())!=-1){
|
||||
options_page->uavObject1->setCurrentIndex(options_page->uavObject1->findText(m_config->getN1DataObject()));
|
||||
@ -155,7 +157,6 @@ QWidget *DialGadgetOptionsPage::createPage(QWidget *parent)
|
||||
void DialGadgetOptionsPage::apply()
|
||||
{
|
||||
m_config->setDialFile(options_page->svgSourceFile->path());
|
||||
m_config->setUseOpenGL(options_page->useOpenGL->checkState());
|
||||
m_config->setDialBackgroundID(options_page->backgroundID->text());
|
||||
m_config->setDialForegroundID(options_page->foregroundID->text());
|
||||
m_config->setDialNeedleID1(options_page->needle1ID->text());
|
||||
@ -180,7 +181,8 @@ void DialGadgetOptionsPage::apply()
|
||||
m_config->setN2Move(options_page->moveNeedle2->currentText());
|
||||
m_config->setN3Move(options_page->moveNeedle3->currentText());
|
||||
m_config->setFont(font.toString());
|
||||
|
||||
m_config->setUseOpenGL(options_page->useOpenGL->checkState());
|
||||
m_config->setBeSmooth(options_page->smoothUpdates->checkState());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,6 +53,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="smoothUpdates">
|
||||
<property name="text">
|
||||
<string>Smooth updates</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -56,6 +56,9 @@ DialGadgetWidget::DialGadgetWidget(QWidget *parent) : QGraphicsView(parent)
|
||||
needle2Target = 0;
|
||||
needle3Target = 0;
|
||||
|
||||
// beSmooth = true;
|
||||
beSmooth = false;
|
||||
|
||||
// This timer mechanism makes needles rotate smoothly
|
||||
connect(&dialTimer, SIGNAL(timeout()), this, SLOT(rotateNeedles()));
|
||||
}
|
||||
@ -548,7 +551,7 @@ void DialGadgetWidget::rotateNeedles()
|
||||
int dialRun = 3;
|
||||
if (n2enabled) {
|
||||
double needle2Diff;
|
||||
if (abs((needle2Value-needle2Target)*10) > 5) {
|
||||
if (abs((needle2Value-needle2Target)*10) > 5 && beSmooth) {
|
||||
needle2Diff =(needle2Target - needle2Value)/5;
|
||||
} else {
|
||||
needle2Diff = needle2Target - needle2Value;
|
||||
@ -580,7 +583,7 @@ void DialGadgetWidget::rotateNeedles()
|
||||
|
||||
// We assume that needle1 always exists!
|
||||
double needle1Diff;
|
||||
if ((abs((needle1Value-needle1Target)*10) > 5)) {
|
||||
if ((abs((needle1Value-needle1Target)*10) > 5) && beSmooth) {
|
||||
needle1Diff = (needle1Target - needle1Value)/5;
|
||||
} else {
|
||||
needle1Diff = needle1Target - needle1Value;
|
||||
@ -604,7 +607,7 @@ void DialGadgetWidget::rotateNeedles()
|
||||
|
||||
if (n3enabled) {
|
||||
double needle3Diff;
|
||||
if ((abs((needle3Value-needle3Target)*10) > 5)) {
|
||||
if ((abs((needle3Value-needle3Target)*10) > 5) && beSmooth) {
|
||||
needle3Diff = (needle3Target - needle3Value)/5;
|
||||
} else {
|
||||
needle3Diff = needle3Target - needle3Value;
|
||||
|
@ -48,6 +48,7 @@ public:
|
||||
DialGadgetWidget(QWidget *parent = 0);
|
||||
~DialGadgetWidget();
|
||||
void enableOpenGL(bool flag);
|
||||
void enableSmoothUpdates(bool flag) { beSmooth = flag; }
|
||||
void setDialFile(QString dfn, QString bg, QString fg, QString n1, QString n2, QString n3,
|
||||
QString n1Move, QString n2Move, QString n3Move);
|
||||
void paint();
|
||||
@ -147,5 +148,6 @@ private:
|
||||
// Rotation timer
|
||||
QTimer dialTimer;
|
||||
|
||||
bool beSmooth;
|
||||
};
|
||||
#endif /* DIALGADGETWIDGET_H_ */
|
||||
|
@ -46,7 +46,8 @@ LineardialGadgetConfiguration::LineardialGadgetConfiguration(QString classId, QS
|
||||
greenMin(66),
|
||||
greenMax(100),
|
||||
factor(1.00),
|
||||
decimalPlaces(0)
|
||||
decimalPlaces(0),
|
||||
useOpenGLFlag(false)
|
||||
{
|
||||
//if a saved configuration exists load it
|
||||
if(qSettings != 0) {
|
||||
|
@ -75,8 +75,8 @@ QWidget *LineardialGadgetOptionsPage::createPage(QWidget *parent)
|
||||
options_page->redMax->setValue(m_config->getRedMax());
|
||||
options_page->factor->setValue(m_config->getFactor());
|
||||
options_page->decPlaces->setValue(m_config->getDecimalPlaces());
|
||||
options_page->useOpenGL->setChecked(m_config->useOpenGL());
|
||||
font.fromString(m_config->getFont());
|
||||
options_page->useOpenGL->setChecked(m_config->useOpenGL());
|
||||
|
||||
// Fills the combo boxes for the UAVObjects
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
|
Loading…
x
Reference in New Issue
Block a user